Spaces:
Sleeping
Sleeping
| import type { Database, RunResult, Statement } from 'better-sqlite3'; | |
| import { type Cache } from "../cache/core/index.js"; | |
| import type { WithCacheConfig } from "../cache/core/types.js"; | |
| import { entityKind } from "../entity.js"; | |
| import type { Logger } from "../logger.js"; | |
| import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js"; | |
| import { type Query } from "../sql/sql.js"; | |
| import type { SQLiteSyncDialect } from "../sqlite-core/dialect.js"; | |
| import { SQLiteTransaction } from "../sqlite-core/index.js"; | |
| import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.js"; | |
| import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteExecuteMethod, SQLitePreparedQuery as PreparedQueryBase, SQLiteSession, type SQLiteTransactionConfig } from "../sqlite-core/session.js"; | |
| export interface BetterSQLiteSessionOptions { | |
| logger?: Logger; | |
| cache?: Cache; | |
| } | |
| type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>; | |
| export declare class BetterSQLiteSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'sync', RunResult, TFullSchema, TSchema> { | |
| private client; | |
| private schema; | |
| static readonly [entityKind]: string; | |
| private logger; | |
| private cache; | |
| constructor(client: Database, dialect: SQLiteSyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: BetterSQLiteSessionOptions); | |
| prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown, queryMetadata?: { | |
| type: 'select' | 'update' | 'delete' | 'insert'; | |
| tables: string[]; | |
| }, cacheConfig?: WithCacheConfig): PreparedQuery<T>; | |
| transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T; | |
| } | |
| export declare class BetterSQLiteTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'sync', RunResult, TFullSchema, TSchema> { | |
| static readonly [entityKind]: string; | |
| transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T): T; | |
| } | |
| export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{ | |
| type: 'sync'; | |
| run: RunResult; | |
| all: T['all']; | |
| get: T['get']; | |
| values: T['values']; | |
| execute: T['execute']; | |
| }> { | |
| private stmt; | |
| private logger; | |
| private fields; | |
| private _isResponseInArrayMode; | |
| private customResultMapper?; | |
| static readonly [entityKind]: string; | |
| constructor(stmt: Statement, query: Query, logger: Logger, cache: Cache, queryMetadata: { | |
| type: 'select' | 'update' | 'delete' | 'insert'; | |
| tables: string[]; | |
| } | undefined, cacheConfig: WithCacheConfig | undefined, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined); | |
| run(placeholderValues?: Record<string, unknown>): RunResult; | |
| all(placeholderValues?: Record<string, unknown>): T['all']; | |
| get(placeholderValues?: Record<string, unknown>): T['get']; | |
| values(placeholderValues?: Record<string, unknown>): T['values']; | |
| } | |
| export {}; | |