UNPKG

@a2lix/schemql

Version:

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

21 lines (18 loc) 1.32 kB
import { BaseAdapterError } from './baseAdapterError.cjs'; export { AdapterErrorCode as SchemQlAdapterErrorCode } from './baseAdapterError.cjs'; import { S as SchemQlAdapter } from '../schemql-DJKXWmTu.js'; import SQLite from 'better-sqlite3'; import '@standard-schema/spec'; 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; } export { BetterSqlite3Adapter, SchemQlAdapterError };