UNPKG

@jadejr/kysely-pglite

Version:

Kysely dialect for @electric-sql/pglite (temporary fork https://github.com/dnlsandiego/kysely-pglite)

31 lines 946 B
import { PGlite, } from '@electric-sql/pglite'; import { isObject, isString } from '@sindresorhus/is'; import fs from 'fs-extra'; import { PGliteDialect } from './pglite-dialect.js'; export class KyselyPGlite { client; /** * Create a new KyselyPGlite instance. * @param options `PGliteOptions` or `PGlite */ constructor(options) { if (options?.dataDir && isString(options.dataDir)) { fs.ensureDirSync(options.dataDir); } if (isObject(options) && options instanceof PGlite) { // @ts-expect-error this.client = options; return; } // @ts-expect-error this.client = new PGlite(options); } static async create(options) { const pg = await PGlite.create(options); return new KyselyPGlite(pg); } get dialect() { return new PGliteDialect({}); } } //# sourceMappingURL=kysely-pglite.js.map