import Log4js from 'log4js'; import * as Shardus from '../shardus/shardus-types'; import Profiler from '../utils/profiler'; import Logger from '../logger'; import { GenericObject, ModelAttributes, ModelData, OperationOptions, ParamEntry } from '.'; import { Database } from 'better-sqlite3'; interface BetterSqlite3Storage { baseDir: string; storageConfig: Shardus.StrictStorageConfiguration; profiler: Profiler; mainLogger: Log4js.Logger; initialized: boolean; storageModels: { [tableName: string]: ModelData; }; db: Database; } declare class BetterSqlite3Storage { constructor(models: [string, ModelAttributes][], storageConfig: Shardus.StrictStorageConfiguration, logger: Logger, baseDir: string, profiler: Profiler); sqlite3Define(modelName: string, modelAttributes: ModelAttributes): void; init(): Promise; close(): Promise; runCreate(createStatement: string): Promise; _checkInit(): void; _create(table: ModelData, object: GenericObject, opts: OperationOptions): Promise; _read(table: ModelData, params: GenericObject, opts: OperationOptions): Promise; _update(table: ModelData, values: GenericObject, where: GenericObject, opts: OperationOptions): Promise; _delete(table: ModelData, where: GenericObject, opts: OperationOptions): Promise; _rawQuery(queryString: string, valueArray: unknown[]): Promise; params2Array(paramsObj: GenericObject, table: ModelData): ParamEntry[]; paramsToWhereStringAndValues(paramsArray: ParamEntry[]): { whereString: string; whereValueArray: unknown[]; }; paramsToAssignmentStringAndValues(paramsArray: ParamEntry[]): { resultString: string; valueArray: unknown[]; }; options2string(optionsObj: OperationOptions): string; run(sql: string, params?: any[]): Promise<{ id: number | bigint; }>; get(sql: string, params?: any[]): Promise; all(sql: string, params?: any[]): Promise; } export default BetterSqlite3Storage;