UNPKG

@egi/smart-db

Version:

Unified Smart DB Access

24 lines (23 loc) 1.27 kB
import Sqlite3 from "sqlite3"; import { AbstractModel } from "../models/abstract-model"; import { SmartDb } from "../smart-db"; import { GenericModelData, SmartDbRunResult, SmartDbTableInfo } from "../smart-db-interfaces"; import { SmartDbSqlBuildData } from "../smart-db-sql-build-data"; export interface SmartDbSqlite3Options { mode?: number; callback?: (this: Sqlite3.Database, err: Error | null) => void; } export declare class SmartDbSqlite3 extends SmartDb { protected db: Sqlite3.Database; constructor(connectorOrDb: string | Sqlite3.Database, options?: SmartDbSqlite3Options); close(): Promise<boolean>; commit(): Promise<void>; exec(script: string): Promise<void>; exists<T extends AbstractModel<T, D>, D extends GenericModelData>(modelClass: string | (new () => T), type?: "view" | "table" | "index", indexTableName?: string): Promise<boolean>; getDatabaseType(): string; getTableInfo(table: string): Promise<SmartDbTableInfo>; rollback(): Promise<void>; protected statementRun(buildData: SmartDbSqlBuildData): Promise<SmartDbRunResult>; protected statementGet<T extends object>(buildData: SmartDbSqlBuildData): Promise<T>; protected statementGetAll<T>(buildData: SmartDbSqlBuildData): Promise<T[]>; }