UNPKG

@onurege3467/zerohelper

Version:

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

32 lines (31 loc) 1.38 kB
import { IDatabase } from './IDatabase'; import { RedisConfig } from './types'; export declare class RedisDatabase extends IDatabase { private config; private client; private keyPrefix; private _queue; private _isReady; private _connectionPromise; constructor(config: RedisConfig); private _ensureConnection; private _flushQueue; private _flushQueueWithError; private _execute; private _getKey; private _getTableKey; select<T = any>(table: string, where?: Record<string, any>): Promise<T[]>; selectOne<T = any>(table: string, where?: Record<string, any>): Promise<T | null>; insert(table: string, data: Record<string, any>): Promise<any>; update(table: string, data: Record<string, any>, where: Record<string, any>): Promise<number>; delete(table: string, where: Record<string, any>): Promise<number>; set(table: string, data: Record<string, any>, where: Record<string, any>): Promise<any>; bulkInsert(table: string, dataArray: Record<string, any>[]): Promise<number>; /** * Atomic Increment using Lua for Redis */ 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 RedisDatabase;