@riao/dbal
Version:
55 lines (54 loc) • 2.24 kB
TypeScript
import { DatabaseRecord } from '../record';
import { ColumnOptions } from '../column';
import { DatabaseQueryBuilder, QueryRepository } from '../dml';
import { SchemaTable, SchemaTableWithColumns } from './schema-table';
import { Schema } from './schema';
import { RepositoryInit, RepositoryOptions } from '../repository';
export interface SchemaQueryRepositoryOptions extends RepositoryOptions {
queryBuilderType: typeof DatabaseQueryBuilder;
}
export interface SchemaQueryRepositoryInit extends RepositoryInit {
database: string;
}
/**
* Use the Schema Query Repository to query your schema information
*/
export declare class SchemaQueryRepository extends QueryRepository {
protected database: string;
protected tablesTable: string;
protected columnsTable: string;
protected databaseNameColumn: string;
protected tableNameColumn: string;
protected tableTypeColumn: string;
protected columnNameColumn: string;
protected columnTypeColumn: string;
protected columnPositionColumn: string;
protected returnedTableTypes: Record<any, 'table' | 'view'>;
constructor(options: SchemaQueryRepositoryOptions);
init(options: SchemaQueryRepositoryInit): void;
getSchema(): Promise<Schema>;
protected getTablesQueryWhere(): {
[x: string]: string;
};
protected getTablesQuery(): Promise<DatabaseRecord[]>;
protected getTablesResultParser(tables: DatabaseRecord[]): {
name: any;
type: "table" | "view";
}[];
getTables(): Promise<SchemaTable[]>;
getTablesWithColumns(): Promise<SchemaTableWithColumns[]>;
protected getPrimaryKeyResultParser(result?: DatabaseRecord): undefined | string;
protected getPrimaryKeyQuery(table: string): Promise<null | DatabaseRecord>;
getPrimaryKeyName(options: {
table: string;
}): Promise<undefined | string>;
protected getColumnsQuery(table: string): Promise<DatabaseRecord[]>;
protected getColumnsResultParser(options: {
records: DatabaseRecord[];
primaryKey?: string;
}): ColumnOptions[];
getColumns(options: {
table: string;
primaryKey?: string;
}): Promise<ColumnOptions[]>;
}