@onurege3467/zerohelper
Version:
ZeroHelper is a versatile high-performance utility library and database framework for Node.js, fully written in TypeScript.
33 lines (32 loc) • 1.44 kB
TypeScript
import { IDatabase } from './IDatabase';
import { JsonConfig } from './types';
export declare class JsonDatabase extends IDatabase {
private filePath;
private db;
private isDirty;
private isWriting;
private writeQueue;
private saveDebounceTimeout;
private saveInterval;
private initPromise;
constructor(config: JsonConfig);
private _execute;
private _load;
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 JsonDatabase;