swaf/dist/db/MysqlConnectionManager.d.ts
2020-04-22 17:49:58 +02:00

24 lines
988 B
TypeScript

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;
}