ORM Support
Kysely
npm: @powersync/kysely-driver
This package enables using Kysely with PowerSync React Native and web SDKs.
It gives JavaScript developers the flexibility to write queries in either JavaScript/TypeScript or SQL, and provides type-safe imperative APIs.
Setup
Set up the PowerSync Database and wrap it with Kysely.
JavaScript Setup
TypeScript Setup
For more information on Kysely typing, see their documentation.
Usage Examples
Below are examples comparing Kysely and PowerSync syntax for common database operations.
Select Operations
Insert Operations
Delete Operations
Update Operations
Watched Queries
For watched queries with Kysely it’s recommended to use the watch()
function from the wrapper package which takes in a Kysely query.