@onurege3467/zerohelper
Version:
ZeroHelper is a versatile high-performance utility library and database framework for Node.js, fully written in TypeScript.
30 lines (29 loc) • 1.44 kB
TypeScript
import { IDatabase } from './IDatabase';
import { MySQLConfig } from './types';
export declare class MySQLDatabase extends IDatabase {
private config;
private pool;
private _queue;
private _connected;
private _connectionPromise;
constructor(config: MySQLConfig);
private _execute;
private _processQueue;
query(sql: string, params?: any[]): Promise<any>;
private _ensureMissingColumns;
ensureTable(table: string, data?: any): 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>;
private _getColumnType;
private _serializeValue;
private _buildWhereClause;
}
export default MySQLDatabase;