swaf/dist/db/MysqlConnectionManager.d.ts

24 lines
988 B
TypeScript
Raw Normal View History

2020-04-22 15:52:17 +02:00
import { Connection, FieldInfo, Pool } from 'mysql';
import Migration from "./Migration";
export interface QueryResult {
readonly results: any[];
readonly fields: FieldInfo[];
readonly other?: any;
foundRows?: number;
}
export declare function query(queryString: string, values?: any, connection?: Connection): Promise<QueryResult>;
export default class MysqlConnectionManager {
private static currentPool?;
private static databaseReady;
private static readonly migrations;
static registerMigration(migration: (version: number) => Migration): void;
static prepare(): Promise<void>;
static get pool(): Pool;
private static createPool;
static endPool(): Promise<void>;
static query(queryString: string, values?: any, connection?: Connection): Promise<QueryResult>;
static wrapTransaction<T>(transaction: (connection: Connection) => Promise<T>): Promise<T>;
private static rejectAndRollback;
private static handleMigrations;
}