/** * PostgreSQL database connection module * Provides connection pooling and health check functionality */ import pg from 'pg'; /** * Database configuration from environment variables */ export interface DatabaseConfig { uri: string; user: string; password: string; maxConnections?: number; idleTimeoutMs?: number; connectionTimeoutMs?: number; } /** * Get database configuration from environment variables */ export declare function getDatabaseConfig(): DatabaseConfig; /** * Initialize the database connection pool * @param config - Optional database configuration (defaults to environment variables) */ export declare function initializePool(config?: DatabaseConfig): pg.Pool; /** * Get the database connection pool * Initializes the pool if not already done */ export declare function getPool(): pg.Pool; /** * Check if the database connection is healthy * @returns true if the database is reachable, false otherwise */ export declare function checkDatabaseHealth(): Promise; /** * Close the database connection pool * Should be called when shutting down the server */ export declare function closePool(): Promise; /** * Execute a query with automatic connection management * @param text - SQL query text * @param params - Query parameters */ export declare function query(text: string, params?: any[]): Promise>; /** * Run database migrations * Creates necessary tables if they don't exist */ export declare function runMigrations(): Promise;