import { Drivers, goodDBOptions, IGoodDB, MathSigns, methodOptions } from "./Types"; import { LRUCache } from "./utils/Caching"; /** * The main class for the GoodDB package * @example Using JSONDriver (sync) * ```javascript * const db = new GoodDB(new JSONDriver({ path: './database.json' })); * ``` * @example Using MongoDBDriver (async) * ```javascript * const db = new GoodDB(new MongoDBDriver({ uri: "..." })); * await db.connect(); * ``` */ export default class GoodDB implements IGoodDB { readonly driver: Drivers; readonly tableName: string; readonly nested: { nested: string; isEnabled: boolean; }; readonly cacheIsEnabled: boolean; readonly isAsync: boolean; cacheService: LRUCache | undefined; readonly options?: goodDBOptions; constructor(driver?: Drivers, options?: goodDBOptions); get getNestedOptions(): { nested: string; nestedIsEnabled: boolean; }; checkKey(key: string): void; set: (key: string, value: any, options?: methodOptions) => boolean | Promise; get: (key: string, options?: methodOptions) => any | Promise; delete: (key: string, options?: methodOptions) => boolean | Promise; setMany: (data: Record, options?: methodOptions) => boolean | Promise; getMany: (keys: string[], options?: methodOptions) => Record | Promise>; deleteMany: (keys: string[], options?: methodOptions) => boolean | Promise; push: (key: string, value: any, options?: methodOptions) => number | Promise; shift: (key: string, options?: methodOptions) => any | Promise; unshift: (key: string, value: any, options?: methodOptions) => number | Promise; pop: (key: string, options?: methodOptions) => any | Promise; pull: (key: string, valueOrCallback: (e: any, i: number, a: any) => any, pullAll?: boolean, options?: methodOptions) => boolean | Promise; find: (key: string, callback: (value: any, index: number, obj: any[]) => unknown, options?: methodOptions) => any | Promise; filter: (key: string, callback: (value: any, index: number, obj: any[]) => unknown, options?: methodOptions) => any[] | Promise; findAndUpdate: (key: string, findCallback: (value: any, index: number, obj: any[]) => unknown, updateCallback: (value: any, index: number, obj: any[]) => any, options?: methodOptions) => any | Promise; findAndUpdateMany: (key: string, findCallback: (value: any, index: number, obj: any[]) => unknown, updateCallback: (value: any, index: number, obj: any[]) => any, options?: methodOptions) => any[] | Promise; distinct: (key: string, value?: (value: any, index: number, obj: any[]) => any, options?: methodOptions) => boolean | Promise; add: (key: string, value: number, options?: methodOptions) => number | Promise; subtract: (key: string, value: number, options?: methodOptions) => number | Promise; multiply: (key: string, value: number, options?: methodOptions) => number | Promise; double: (key: string, options?: methodOptions) => number | Promise; math: (key: string, mathSign: MathSigns, value: number, options?: methodOptions) => number | Promise; startsWith: (key: string, options?: methodOptions) => any | Promise; endsWith: (key: string, options?: methodOptions) => any | Promise; includes: (key: string, options?: methodOptions) => any | Promise; keys: () => string[] | Promise; values: () => any[] | Promise; all: (type?: 'object' | 'array') => any | Promise; clear: () => boolean | Promise; type: (key: string, options?: methodOptions) => string | Promise; size: (key: string, options?: methodOptions) => number | Promise; has: (key: string, options?: methodOptions) => boolean | Promise; table: (name: string) => GoodDB | Promise; connect(): Promise; disconnect(): Promise; } export { GoodDB };