UNPKG

kysely-do

Version:

Kysely dialect for Cloudflare Durable Objects

32 lines (29 loc) 954 B
import { Dialect, SqliteAdapter, Driver, QueryCompiler, Kysely, DatabaseIntrospector } from 'kysely'; /** * Config for the D1 dialect. Pass your D1 instance to this object that you bound in `wrangler.toml`. */ interface DODialectConfig { ctx: DurableObjectState; } /** * DO dialect that adds support for [Cloudflare Durable Objects][0] in [Kysely][1]. * The constructor takes the instance of your DO database that you bound in `wrangler.toml`. * * ```typescript * new DODialect({ * database: env.DB, * }) * ``` * * [0]: https://developers.cloudflare.com/durable-objects/ * [1]: https://github.com/koskimas/kysely */ declare class DODialect implements Dialect { #private; constructor(config: DODialectConfig); createAdapter(): SqliteAdapter; createDriver(): Driver; createQueryCompiler(): QueryCompiler; createIntrospector(db: Kysely<any>): DatabaseIntrospector; } export { DODialect, type DODialectConfig };