2025-11-10 19:43:02 -08:00
|
|
|
/**
|
|
|
|
|
* PostgreSQL database client with connection pooling
|
|
|
|
|
*/
|
|
|
|
|
import { Pool, QueryResult, QueryResultRow } from 'pg';
|
2025-11-12 22:03:42 -08:00
|
|
|
export type { QueryResult, QueryResultRow };
|
2025-11-10 19:43:02 -08:00
|
|
|
export interface DatabaseConfig {
|
|
|
|
|
connectionString?: string;
|
|
|
|
|
host?: string;
|
|
|
|
|
port?: number;
|
|
|
|
|
database?: string;
|
|
|
|
|
user?: string;
|
|
|
|
|
password?: string;
|
|
|
|
|
max?: number;
|
|
|
|
|
idleTimeoutMillis?: number;
|
|
|
|
|
connectionTimeoutMillis?: number;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Create a PostgreSQL connection pool
|
|
|
|
|
*/
|
|
|
|
|
export declare function createPool(config: DatabaseConfig): Pool;
|
|
|
|
|
/**
|
|
|
|
|
* Get or create the default database pool
|
|
|
|
|
*/
|
|
|
|
|
export declare function getPool(config?: DatabaseConfig): Pool;
|
|
|
|
|
/**
|
|
|
|
|
* Execute a query
|
|
|
|
|
*/
|
|
|
|
|
export declare function query<T extends QueryResultRow = QueryResultRow>(text: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
|
|
|
/**
|
|
|
|
|
* Close the database pool
|
|
|
|
|
*/
|
|
|
|
|
export declare function closePool(): Promise<void>;
|
|
|
|
|
/**
|
|
|
|
|
* Health check for database connection
|
|
|
|
|
*/
|
|
|
|
|
export declare function healthCheck(): Promise<boolean>;
|
|
|
|
|
//# sourceMappingURL=client.d.ts.map
|