kysely-d1
Version:
Kysely dialect for Cloudflare D1
30 lines (29 loc) • 960 B
TypeScript
import { DatabaseIntrospector, Dialect, Driver, Kysely, SqliteAdapter, QueryCompiler } from 'kysely';
import type { D1Database } from '@cloudflare/workers-types';
/**
* Config for the D1 dialect. Pass your D1 instance to this object that you bound in `wrangler.toml`.
*/
export interface D1DialectConfig {
database: D1Database;
}
/**
* D1 dialect that adds support for [Cloudflare D1][0] in [Kysely][1].
* The constructor takes the instance of your D1 database that you bound in `wrangler.toml`.
*
* ```typescript
* new D1Dialect({
* database: env.DB,
* })
* ```
*
* [0]: https://blog.cloudflare.com/introducing-d1/
* [1]: https://github.com/koskimas/kysely
*/
export declare class D1Dialect implements Dialect {
#private;
constructor(config: D1DialectConfig);
createAdapter(): SqliteAdapter;
createDriver(): Driver;
createQueryCompiler(): QueryCompiler;
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
}