mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
25 lines
549 B
Markdown
25 lines
549 B
Markdown
Forked from https://github.com/betarixm/kysely-sql-js
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { type GeneratedAlways, Kysely } from 'kysely';
|
|
import initSqlJs from 'sql.js';
|
|
|
|
import { SqlJsDialect } from '@zenstackhq/kysely-sql-js';
|
|
|
|
interface Database {
|
|
person: {
|
|
id: GeneratedAlways<number>;
|
|
first_name: string | null;
|
|
last_name: string | null;
|
|
age: number;
|
|
};
|
|
}
|
|
|
|
const SqlJsStatic = await initSqlJs();
|
|
|
|
export const db = new Kysely<Database>({
|
|
dialect: new SqlJsDialect({ sqlJs: new SqlJsStatic.Database() }),
|
|
});
|
|
```
|