inceptum
Version:
hipages take on the foundational library for enterprise-grade apps written in NodeJS
74 lines (73 loc) • 2.42 kB
TypeScript
import { Client } from 'pg';
import { Factory } from 'generic-pool';
import { DBClient, DBClientConfig } from '../db/DBClient';
import { DBTransaction } from '../db/DBTransaction';
import { ConnectionConfig, ConnectionPool } from '../db/ConnectionPool';
/**
* CONFIGURATION OBJECTS
*/
export interface PostgresConnectionConfig extends ConnectionConfig {
/**
* number of milliseconds before a query will time out default is no timeout
*/
statement_timeout?: number;
/**
* The hostname of the database you are connecting to. (Default: localhost)
*/
host: string;
/**
* The port number to connect to. (Default: 3306)
*/
port?: number;
/**
* Name of the database to connect to
*/
database: string;
/**
* User used to connect
*/
user: string;
/**
* Password used to authenticate on connection
*/
password: string;
/**
* The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
*/
connectTimeout?: number;
/**
* The source IP address to use for TCP connection
*/
localAddress?: string;
/**
* The path to a unix domain socket to connect to. When used host and port are ignored
*/
socketPath?: string;
/**
* The timezone used to store local dates. (Default: 'local')
*/
timezone?: string;
/**
* object with ssl parameters or a string containing name of ssl profile
*/
ssl?: any;
/**
* The character set to use in the connection
*/
charset?: string;
}
export interface PostgresClientConfiguration extends DBClientConfig<PostgresConnectionConfig> {
}
export declare class PostgresTransaction extends DBTransaction<Client> {
protected runQueryInConnection(sql: string, bindsArr: Array<any>): Promise<any>;
}
/**
* A MySQL client you can use to execute queries against MySQL
*/
export declare class PostgresClient extends DBClient<Client, PostgresTransaction, PostgresConnectionConfig, PostgresClientConfiguration> {
initialise(): Promise<void>;
getConnectionFactory(name: string, connectionConfig: PostgresConnectionConfig): Factory<Client>;
getNewDBTransaction(readonly: boolean, connectionPool: ConnectionPool<Client>): PostgresTransaction;
getPingQuery(): string;
getDefaultConnectionConfig(): PostgresConnectionConfig;
}