UNPKG

@a2lix/schemql

Version:

A lightweight TypeScript library that enhances your SQL workflow by combining raw SQL with targeted type safety and schema validation

19 lines (18 loc) 1.31 kB
import { AdapterErrorCode, BaseAdapterError } from "./baseAdapterError.mjs"; import { n as SchemQlAdapter } from "../schemql-oq-xONEF.mjs"; import * as SQLite from "better-sqlite3"; //#region src/adapters/betterSqlite3Adapter.d.ts declare class BetterSqlite3Adapter<T = unknown> implements SchemQlAdapter<T> { private db; constructor(db: SQLite.Database); queryAll: <TResult, TParams extends Record<string, any> | undefined = Record<string, any> | undefined>(sql: string) => (params?: TParams) => TResult[]; queryFirst: <TResult, TParams extends Record<string, any> | undefined = Record<string, any> | undefined>(sql: string) => (params?: TParams) => TResult | undefined; queryFirstOrThrow: <TResult, TParams extends Record<string, any> | undefined = Record<string, any> | undefined>(sql: string) => (params?: TParams) => NonNullable<TResult>; queryIterate: <_TResult, TParams extends Record<string, any> | undefined = Record<string, any> | undefined>(sql: string) => (params?: TParams) => any; private handleTypeErrorRun; } declare class SchemQlAdapterError extends BaseAdapterError { static createFromBetterSqlite3: (error: SQLite.SqliteError | TypeError) => SchemQlAdapterError; } //#endregion export { BetterSqlite3Adapter, SchemQlAdapterError, AdapterErrorCode as SchemQlAdapterErrorCode };