mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 18:35:58 +00:00
typescript common lib
This commit is contained in:
36
lib/src/index.ts
Normal file
36
lib/src/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { ChildProcess } from "child_process";
|
||||
|
||||
export interface QueryResult {
|
||||
rows: any[];
|
||||
}
|
||||
|
||||
export interface EngineDriver {
|
||||
connect({ server, port, user, password });
|
||||
query(pool, sql: string): Promise<QueryResult>;
|
||||
getVersion(pool): Promise<string>;
|
||||
listDatabases(pool): Promise<{ name: string }[]>;
|
||||
analyseFull(pool): Promise<void>;
|
||||
analyseIncremental(pool): Promise<void>;
|
||||
}
|
||||
|
||||
export interface NamedObjectInfo {
|
||||
pureName: string;
|
||||
schemaName: string;
|
||||
}
|
||||
|
||||
export interface TableInfo extends NamedObjectInfo {}
|
||||
|
||||
export interface DatabaseInfo {
|
||||
tables: TableInfo[];
|
||||
}
|
||||
|
||||
export interface OpenedDatabaseConnection {
|
||||
conid: string;
|
||||
database: string;
|
||||
structure: DatabaseInfo;
|
||||
subprocess: ChildProcess;
|
||||
}
|
||||
|
||||
export function sum(a: number, b: number) {
|
||||
return a + b;
|
||||
}
|
||||
Reference in New Issue
Block a user