@jadejr/kysely-pglite
Version:
Kysely dialect for @electric-sql/pglite (temporary fork https://github.com/dnlsandiego/kysely-pglite)
57 lines (56 loc) • 1.56 kB
TypeScript
import { type DatabaseIntrospector, type Dialect, type DialectAdapter, type Driver, type Kysely, type QueryCompiler } from 'kysely';
import { PGliteDialectConfig } from './pglite-dialect-config.js';
/**
*
* PGlite dialect that uses the [@electric-sql/pglite](https://pglite.dev) library.
*
* The constructor takes an instance of {@link PGliteDialectConfig}.
*
* ```ts
* import { PGlite } from '@electric-sql/pglite'
* import { PGliteDialect } from 'kysely-pglite'
*
* new PGliteDialect({
* PGlite: new PGlite({
* 'dataDir': '/path/to/dataDir',
* // other options
* })
* })
* ```
*
* If you want PGlite to only be created once it's first used, `PGlite`
* can be a function:
*
* The constructor takes an instance of {@link PGliteDialectConfig}.
*
* ```ts
* import { PGlite } from '@electric-sql/pglite'
* import { PGliteDialect } from 'kysely-pglite'
*
* new PGliteDialect({
* PGlite: async () => new PGlite({
* 'dataDir: '/path/to/dataDir',
* // other options
* })
* })
* ```
*
* You can also let the dialect create the PGlite instance for you while using PGlite's options
*
* ```ts
* new PGliteDialect({
* PGliteOptions: {
* 'dataDir: '/path/to/dataDir',
* // other options
* }
* })
* ```
*/
export declare class PGliteDialect implements Dialect {
#private;
constructor(config: PGliteDialectConfig);
createDriver(): Driver;
createQueryCompiler(): QueryCompiler;
createAdapter(): DialectAdapter;
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
}