UNPKG

kysely-bun-worker

Version:
48 lines (45 loc) 1.17 kB
import Database from 'bun:sqlite'; import { IBaseSqliteDialectConfig } from 'kysely-generic-sqlite'; type DBOptions = Exclude<ConstructorParameters<typeof Database>[1], undefined>; interface BunWorkerDialectConfig extends IBaseSqliteDialectConfig { /** * DB file path * * @default ':memory:' */ url?: string; /** * DB constructor options * @default { create: true } */ dbOptions?: DBOptions; cacheStatment?: boolean; /** * custom worker, default is a worker that use bun:sqlite */ worker?: Worker; } type InitData = { fileName: string; cache: boolean; opt: DBOptions; }; interface BunSqliteDialectConfig extends IBaseSqliteDialectConfig { /** * db file path * * @default ':memory:' */ url?: string; /** * use `bun:sqlite` built-in statment cache * @see https://bun.sh/docs/api/sqlite#query */ cacheStatment?: boolean; /** * DB constructor options * @default { create: true } */ dbOptions?: DBOptions; } export type { BunSqliteDialectConfig as B, DBOptions as D, InitData as I, BunWorkerDialectConfig as a };