import { TxnOption } from 'oak-domain/lib/types'; import { EntityDict, StorageSchema } from 'oak-domain/lib/types'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; import { PostgreSQLConfiguration } from './types/Configuration'; import { PostgreSQLTranslator } from './translator'; import { MigrationPlanningOptions, Plan, SchemaInspectionResult } from '../types/migration'; import type { Pool as PostgreSqlPool, PoolClient as PostgreSqlPoolClient, QueryResult as PostgreSqlQueryResult } from 'pg'; export declare class PostgreSQLConnector { pool?: PostgreSqlPool; configuration: PostgreSQLConfiguration; txnDict: Record; txnExecQueueDict: Record>; constructor(configuration: PostgreSQLConfiguration); connect(): void; disconnect(): Promise; startTransaction(option?: TxnOption): Promise; /** * 映射隔离级别到 PostgreSQL 语法 */ private mapIsolationLevel; exec(sql: string, txn?: string): Promise<[Record[], PostgreSqlQueryResult]>; private enqueueTxnQuery; private enqueueTxnTask; readSchema(translator: PostgreSQLTranslator): Promise>; inspectSchema(translator: PostgreSQLTranslator): Promise>; diffSchema(currentSchema: StorageSchema, targetSchema: StorageSchema, translator: PostgreSQLTranslator, options?: MigrationPlanningOptions): Plan; commitTransaction(txn: string): Promise; rollbackTransaction(txn: string): Promise; /** * 获取连接池状态 */ getPoolStatus(): { total: number; idle: number; waiting: number; }; }