plugin-postgresql-connector
Version:
NocoBase plugin for connecting to external PostgreSQL databases
90 lines • 2.94 kB
TypeScript
import { ConnectionManager } from './ConnectionManager';
export interface TableInfo {
table_name: string;
table_schema: string;
table_type: string;
table_comment?: string;
column_count?: number;
row_count?: number;
}
export interface ColumnInfo {
column_name: string;
data_type: string;
is_nullable: string;
column_default?: string;
character_maximum_length?: number;
numeric_precision?: number;
numeric_scale?: number;
column_comment?: string;
ordinal_position: number;
is_primary_key: boolean;
is_foreign_key: boolean;
foreign_key_table?: string;
foreign_key_column?: string;
}
export interface ViewInfo {
view_name: string;
view_schema: string;
view_definition: string;
is_updatable: string;
check_option?: string;
}
export interface FunctionInfo {
function_name: string;
function_schema: string;
routine_type: string;
data_type?: string;
routine_definition?: string;
external_language?: string;
parameter_count?: number;
parameters?: Array<{
parameter_name: string;
data_type: string;
parameter_mode: string;
}>;
}
export interface IndexInfo {
index_name: string;
table_name: string;
column_names: string[];
is_unique: boolean;
is_primary: boolean;
index_type: string;
}
export interface SchemaStatistics {
total_tables: number;
total_views: number;
total_functions: number;
total_procedures: number;
total_indexes: number;
database_size: string;
schemas: string[];
}
export interface DatabaseInfo {
database_name: string;
database_size: string;
encoding: string;
collation: string;
connection_count: number;
version: string;
uptime?: string;
}
export declare class SchemaService {
private connectionManager;
constructor(connectionManager: ConnectionManager);
getDatabaseInfo(connectionId: string): Promise<DatabaseInfo>;
getSchemaStatistics(connectionId: string, schema?: string): Promise<SchemaStatistics>;
getTables(connectionId: string, schema?: string): Promise<TableInfo[]>;
getTableColumns(connectionId: string, tableName: string, schema?: string): Promise<ColumnInfo[]>;
getViews(connectionId: string, schema?: string): Promise<ViewInfo[]>;
getFunctions(connectionId: string, schema?: string): Promise<FunctionInfo[]>;
getIndexes(connectionId: string, tableName?: string, schema?: string): Promise<IndexInfo[]>;
searchObjects(connectionId: string, searchTerm: string, objectTypes?: string[], schema?: string): Promise<any[]>;
getTableRelationships(connectionId: string, tableName: string, schema?: string): Promise<any[]>;
/**
* Get table size and statistics
*/
getTableStatistics(connectionId: string, tableName: string, schema?: string): Promise<any>;
}
export default SchemaService;
//# sourceMappingURL=SchemaService.d.ts.map