Skip to content

feat(expo-sqlite): add optional async driver#5533

Open
maxencehenneron wants to merge 1 commit intodrizzle-team:mainfrom
maxencehenneron:feat/expo-sqlite-async
Open

feat(expo-sqlite): add optional async driver#5533
maxencehenneron wants to merge 1 commit intodrizzle-team:mainfrom
maxencehenneron:feat/expo-sqlite-async

Conversation

@maxencehenneron
Copy link
Copy Markdown

The existing expo-sqlite driver operates in sync mode, which blocks the UI thread and does not work on web (using react-native-web).

This adds a new async driver at drizzle-orm/expo-sqlite/async that uses expo-sqlite's async APIs (executeAsync, getAllAsync, getFirstAsync, executeForRawResultAsync).

The existing sync driver is completely unchanged for backward compatibility.

Usage

// Existing sync driver (unchanged)
import { drizzle } from 'drizzle-orm/expo-sqlite';
const db = drizzle(sqliteDb);
const users = db.select().from(usersTable).all(); // sync

// New async driver
import { drizzle } from 'drizzle-orm/expo-sqlite/async';
const db = drizzle(sqliteDb);
const users = await db.select().from(usersTable); // async

The existing expo-sqlite driver operates in sync mode, which blocks the
UI thread and does not work on web. This adds a new async driver at
`drizzle-orm/expo-sqlite/async` that uses expo-sqlite's async APIs
(executeAsync, getAllAsync, getFirstAsync, executeForRawResultAsync).

The existing sync driver is completely unchanged for backward
compatibility.
@maxencehenneron
Copy link
Copy Markdown
Author

fixes #5240

@sahlet-official
Copy link
Copy Markdown

Hi @maxencehenneron
Is there any info on when the update will be in the release?

@sahlet-official
Copy link
Copy Markdown

@maxencehenneron

looks like you didnt take into account some palces of code that also should be fixed.
this patch from the bug can help to see shortage.
#5240 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants