UNPKG

@onurege3467/zerohelper

Version:

ZeroHelper is a versatile high-performance utility library and database framework for Node.js, fully written in TypeScript.

34 lines (33 loc) 1.47 kB
import { IDatabase } from './IDatabase'; import { ToonConfig } from './types'; export declare class ToonDatabase extends IDatabase { private filePath; private db; private isDirty; private isWriting; private writeQueue; private saveDebounceTimeout; private saveInterval; private initPromise; constructor(config: ToonConfig); private _execute; private _load; private _getTable; private _queueRequest; private _processQueue; private _scheduleSave; private _saveNow; private flushSync; ensureTable(table: string): Promise<void>; insert(table: string, data: Record<string, any>): Promise<number>; update(table: string, data: Record<string, any>, where: Record<string, any>): Promise<number>; delete(table: string, where: Record<string, any>): Promise<number>; select<T = any>(table: string, where?: Record<string, any> | null): Promise<T[]>; selectOne<T = any>(table: string, where?: Record<string, any> | null): Promise<T | null>; set(table: string, data: Record<string, any>, where: Record<string, any>): Promise<any>; bulkInsert(table: string, dataArray: Record<string, any>[]): Promise<number>; increment(table: string, incs: Record<string, number>, where?: Record<string, any>): Promise<number>; decrement(table: string, decs: Record<string, number>, where?: Record<string, any>): Promise<number>; close(): Promise<void>; } export default ToonDatabase;