UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

35 lines (34 loc) 1.59 kB
import type { KyselyPlugin, QueryResult } from "kysely"; import { type IGenericSqlite, type Promisable, parseBigInt, buildQueryFn } from "kysely-generic-sqlite"; import { SqliteConnection } from "./SqliteConnection"; import type { ConnQuery, ConnQueryResults, Features } from "../Connection"; import type { MaybePromise } from "../../.."; export type { IGenericSqlite }; export type TStatement = { sql: string; parameters?: any[] | readonly any[]; }; export interface IGenericCustomSqlite<DB = unknown> extends IGenericSqlite<DB> { batch?: (stmts: TStatement[]) => Promisable<QueryResult<any>[]>; } export type GenericSqliteConnectionConfig<Database = unknown> = { name?: string; additionalPlugins?: KyselyPlugin[]; excludeTables?: string[]; onCreateConnection?: (db: Database) => MaybePromise<void>; supports?: Partial<Features>; }; export declare class GenericSqliteConnection<DB = unknown> extends SqliteConnection<DB> { #private; db: DB; private executor; name: string; constructor(db: DB, executor: () => Promisable<IGenericCustomSqlite<DB>>, config?: GenericSqliteConnectionConfig); private getExecutor; executeQueries<O extends ConnQuery[]>(...qbs: O): Promise<ConnQueryResults<O>>; } export declare function genericSqlite<DB>(name: string, db: DB, executor: (utils: typeof genericSqliteUtils) => Promisable<IGenericCustomSqlite<DB>>, config?: GenericSqliteConnectionConfig): GenericSqliteConnection<DB>; export declare const genericSqliteUtils: { parseBigInt: typeof parseBigInt; buildQueryFn: typeof buildQueryFn; };