Files
dbgate/packages/types/engines.d.ts
2020-04-05 20:48:04 +02:00

32 lines
856 B
TypeScript

import { QueryResult } from './query';
import { SqlDialect } from './dialect';
import { SqlDumper } from './dumper';
import { DatabaseInfo } from './dbinfo';
export interface StreamOptions {
recordset: (columns) => void;
row: (row) => void;
error: (error) => void;
done: (result) => void;
info: (info) => void;
}
export interface EngineDriver {
engine: string;
connect(nativeModules, { server, port, user, password, database }): any;
query(pool: any, sql: string): Promise<QueryResult>;
stream(pool: any, sql: string, options: StreamOptions);
getVersion(pool: any): Promise<{ version: string }>;
listDatabases(
pool: any
): Promise<
{
name: string;
}[]
>;
analyseFull(pool: any): Promise<DatabaseInfo>;
// analyseIncremental(pool: any): Promise<void>;
dialect: SqlDialect;
createDumper(): SqlDumper;
}