UNPKG

@itrocks/mysql-maintainer

Version:

Reactively maintains database structure by updating schema and retrying on MySQL errors

17 lines (16 loc) 850 B
import { ObjectOrType } from '@itrocks/class-type'; import { Connection } from 'mariadb'; import { QueryOptions } from 'mariadb-share'; import { SqlError } from 'mariadb-share'; export type Context = ObjectOrType | ObjectOrType[]; export declare class Contextual implements Partial<Connection> { [x: number]: (() => Promise<void>) | undefined; contexts: Context[]; errorCount: Record<string, Record<string, Array<number>>>; superQuery: <T = any>(sql: string | QueryOptions, values?: any) => Promise<T>; applyTo(connection: ContextualConnection): Promise<ContextualConnection>; incrementErrorCount(sql: string, error: any): this is Connection; isSqlError(error: any): error is SqlError; query<T = any>(sql: string | QueryOptions, values?: any): Promise<T>; } export type ContextualConnection = Connection & Contextual;