1 | import { Client } from 'pg';
|
2 | import { Factory } from 'generic-pool';
|
3 | import { DBClient, DBClientConfig } from '../db/DBClient';
|
4 | import { DBTransaction } from '../db/DBTransaction';
|
5 | import { ConnectionConfig, ConnectionPool } from '../db/ConnectionPool';
|
6 |
|
7 |
|
8 |
|
9 | export interface PostgresConnectionConfig extends ConnectionConfig {
|
10 | |
11 |
|
12 |
|
13 | statement_timeout?: number;
|
14 | |
15 |
|
16 |
|
17 | host: string;
|
18 | |
19 |
|
20 |
|
21 | port?: number;
|
22 | |
23 |
|
24 |
|
25 | database: string;
|
26 | |
27 |
|
28 |
|
29 | user: string;
|
30 | |
31 |
|
32 |
|
33 | password: string;
|
34 | |
35 |
|
36 |
|
37 | connectTimeout?: number;
|
38 | |
39 |
|
40 |
|
41 | localAddress?: string;
|
42 | |
43 |
|
44 |
|
45 | socketPath?: string;
|
46 | |
47 |
|
48 |
|
49 | timezone?: string;
|
50 | |
51 |
|
52 |
|
53 | ssl?: any;
|
54 | |
55 |
|
56 |
|
57 | charset?: string;
|
58 | }
|
59 | export interface PostgresClientConfiguration extends DBClientConfig<PostgresConnectionConfig> {
|
60 | }
|
61 | export declare class PostgresTransaction extends DBTransaction<Client> {
|
62 | protected runQueryInConnection(sql: string, bindsArr: Array<any>): Promise<any>;
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 | export declare class PostgresClient extends DBClient<Client, PostgresTransaction, PostgresConnectionConfig, PostgresClientConfiguration> {
|
68 | initialise(): Promise<void>;
|
69 | getConnectionFactory(name: string, connectionConfig: PostgresConnectionConfig): Factory<Client>;
|
70 | getNewDBTransaction(readonly: boolean, connectionPool: ConnectionPool<Client>): PostgresTransaction;
|
71 | getPingQuery(): string;
|
72 | getDefaultConnectionConfig(): PostgresConnectionConfig;
|
73 | }
|