@onurege3467/zerohelper
Version:
ZeroHelper is a versatile high-performance utility library and database framework for Node.js, fully written in TypeScript.
29 lines (28 loc) • 1.23 kB
TypeScript
import { IDatabase } from './IDatabase';
import { PostgreSQLConfig } from './types';
export declare class PostgreSQLDatabase extends IDatabase {
private config;
private pool;
private _queue;
private _connected;
private _connectionPromise;
constructor(config: PostgreSQLConfig);
private _execute;
private _processQueue;
query(sql: string, params?: any[]): Promise<any>;
ensureTable(table: string, data?: any): Promise<void>;
insert(table: string, data: any): Promise<any>;
update(table: string, data: any, where: any): Promise<number>;
delete(table: string, where: any): Promise<number>;
select<T = any>(table: string, where?: any): Promise<T[]>;
selectOne<T = any>(table: string, where?: any): Promise<T | null>;
set(table: string, data: any, where: any): Promise<any>;
bulkInsert(table: string, dataArray: any[]): Promise<number>;
increment(table: string, incs: Record<string, number>, where: any): Promise<number>;
decrement(table: string, decs: Record<string, number>, where: any): Promise<number>;
close(): Promise<void>;
private _getColumnType;
private _serializeValue;
private _buildWhereClause;
}
export default PostgreSQLDatabase;