mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 08:03:58 +00:00
introduced yarn workspace
This commit is contained in:
51
packages/types/dbinfo.d.ts
vendored
Normal file
51
packages/types/dbinfo.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
export interface NamedObjectInfo {
|
||||
pureName: string;
|
||||
schemaName: string;
|
||||
}
|
||||
|
||||
export interface ColumnReference {
|
||||
columnName: string;
|
||||
refColumnName?: string;
|
||||
}
|
||||
|
||||
export interface ConstraintInfo extends NamedObjectInfo {
|
||||
constraintName: string;
|
||||
constraintType: string;
|
||||
}
|
||||
|
||||
export interface ColumnsConstraintInfo extends ConstraintInfo {
|
||||
columns: ConstraintInfo[];
|
||||
}
|
||||
|
||||
export interface PrimaryKeyInfo extends ColumnsConstraintInfo {}
|
||||
|
||||
export interface ForeignKeyInfo extends ColumnsConstraintInfo {
|
||||
refSchemaName: string;
|
||||
refTableName: string;
|
||||
updateAction: string;
|
||||
deleteAction: string;
|
||||
}
|
||||
|
||||
export interface ColumnInfo {
|
||||
columnName: string;
|
||||
notNull: boolean;
|
||||
autoIncrement: boolean;
|
||||
dataType: string;
|
||||
precision: number;
|
||||
scale: number;
|
||||
length: number;
|
||||
computedExpression: string;
|
||||
isPersisted: boolean;
|
||||
isSparse: boolean;
|
||||
defaultValue: string;
|
||||
defaultConstraint: string;
|
||||
}
|
||||
export interface TableInfo extends NamedObjectInfo {
|
||||
columns: ColumnInfo[];
|
||||
primaryKey?: PrimaryKeyInfo;
|
||||
foreignKeys: ForeignKeyInfo[];
|
||||
dependencies?: ForeignKeyInfo[];
|
||||
}
|
||||
export interface DatabaseInfo {
|
||||
tables: TableInfo[];
|
||||
}
|
||||
5
packages/types/dialect.d.ts
vendored
Normal file
5
packages/types/dialect.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface SqlDialect {
|
||||
rangeSelect?: boolean;
|
||||
limitSelect?: boolean;
|
||||
quoteIdentifier(s: string): string;
|
||||
}
|
||||
5
packages/types/dumper.d.ts
vendored
Normal file
5
packages/types/dumper.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface SqlDumper {
|
||||
s: string;
|
||||
put(format: string, ...args);
|
||||
putCmd(format: string, ...args);
|
||||
}
|
||||
21
packages/types/engines.d.ts
vendored
Normal file
21
packages/types/engines.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { QueryResult } from "./query";
|
||||
import { SqlDialect } from "./dialect";
|
||||
import { SqlDumper } from "./dumper";
|
||||
import { DatabaseInfo } from "./dbinfo";
|
||||
|
||||
export interface EngineDriver {
|
||||
connect(driverModules, { server, port, user, password, database }): any;
|
||||
query(pool: any, sql: string): Promise<QueryResult>;
|
||||
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;
|
||||
}
|
||||
13
packages/types/index.d.ts
vendored
Normal file
13
packages/types/index.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ChildProcess } from "child_process";
|
||||
import { DatabaseInfo } from "./dbinfo";
|
||||
export interface OpenedDatabaseConnection {
|
||||
conid: string;
|
||||
database: string;
|
||||
structure: DatabaseInfo;
|
||||
subprocess: ChildProcess;
|
||||
}
|
||||
export * from "./engines";
|
||||
export * from "./dbinfo";
|
||||
export * from "./query";
|
||||
export * from "./dialect";
|
||||
export * from "./dumper";
|
||||
7
packages/types/package.json
Normal file
7
packages/types/package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"name": "@dbgate/types",
|
||||
"types": "index.d.ts",
|
||||
"main": "",
|
||||
"typeScriptVersion": "2.8"
|
||||
}
|
||||
13
packages/types/query.d.ts
vendored
Normal file
13
packages/types/query.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface RangeDefinition {
|
||||
offset: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export interface QueryResultColumn {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface QueryResult {
|
||||
rows: any[];
|
||||
columns: QueryResultColumn[];
|
||||
}
|
||||
Reference in New Issue
Block a user