mirror of
https://github.com/ershisan99/db-studio.git
synced 2025-12-17 05:09:25 +00:00
add login support (wonky still)
This commit is contained in:
51
api/src/drivers/driver.interface.ts
Normal file
51
api/src/drivers/driver.interface.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export type WithSort<T> = T & { sortField?: string; sortDesc?: boolean };
|
||||
export type WithPagination<T> = T & { perPage: number; page: number };
|
||||
export type WithSortPagination<T> = WithPagination<WithSort<T>>;
|
||||
|
||||
export type Credentials =
|
||||
| {
|
||||
username: string;
|
||||
password: string;
|
||||
host: string;
|
||||
type: string;
|
||||
port: string;
|
||||
database: string;
|
||||
ssl: string;
|
||||
}
|
||||
| {
|
||||
connectionString: string;
|
||||
};
|
||||
|
||||
export interface Driver {
|
||||
getAllDatabases(credentials: Credentials): Promise<string[]>;
|
||||
getAllTables(
|
||||
credentials: Credentials,
|
||||
args: WithSort<{ dbName: string }>,
|
||||
): Promise<any[]>;
|
||||
getTableData(
|
||||
credentials: Credentials,
|
||||
args: WithSortPagination<{ tableName: string; dbName: string }>,
|
||||
): Promise<{
|
||||
count: number;
|
||||
data: Record<string, any>[];
|
||||
}>;
|
||||
getTableColumns(
|
||||
credentials: Credentials,
|
||||
args: { dbName: string; tableName: string },
|
||||
): Promise<any[]>;
|
||||
getTableIndexes(
|
||||
credentials: Credentials,
|
||||
args: { dbName: string; tableName: string },
|
||||
): Promise<any[]>;
|
||||
getTableForeignKeys(
|
||||
credentials: Credentials,
|
||||
args: { dbName: string; tableName: string },
|
||||
): Promise<any[]>;
|
||||
executeQuery(
|
||||
credentials: Credentials,
|
||||
query: string,
|
||||
): Promise<{
|
||||
count: number;
|
||||
data: Record<string, any>[];
|
||||
}>;
|
||||
}
|
||||
Reference in New Issue
Block a user