UNPKG

plugin-postgresql-connector

Version:

NocoBase plugin for connecting to external PostgreSQL databases

69 lines 1.87 kB
import { PoolClient } from 'pg'; export interface ConnectionConfig { host: string; port: number; database: string; username: string; password: string; ssl: boolean; connectionOptions?: object; } export interface ConnectionResult { success: boolean; connectionId?: string; error?: string; } export declare class ConnectionManager { private pools; private readonly encryptionKey; private readonly maxConnections; private readonly connectionTimeout; private readonly idleTimeout; constructor(); /** * Create a new connection pool and test the connection */ createConnection(connectionConfig: ConnectionConfig): Promise<ConnectionResult>; /** * Get a client from the connection pool */ getConnection(connectionId: string): Promise<PoolClient>; /** * Close a specific connection pool */ closeConnection(connectionId: string): Promise<void>; /** * Close all connection pools */ closeAllConnections(): Promise<void>; /** * Test connection without creating a pool */ testConnection(connectionConfig: ConnectionConfig): Promise<ConnectionResult>; /** * Get connection pool statistics */ getConnectionStats(connectionId: string): object | null; /** * Get all active connection IDs */ getActiveConnections(): string[]; /** * Encrypt password for storage */ encryptPassword(password: string): string; /** * Decrypt password from storage */ decryptPassword(encryptedPassword: string): string; /** * Generate unique connection ID */ private generateConnectionId; /** * Cleanup method for graceful shutdown */ destroy(): Promise<void>; } export default ConnectionManager; //# sourceMappingURL=ConnectionManager.d.ts.map