mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
Merge pull request #25767 from ottopaaso/master
[@types/pg] Add keepAlive configuration option
This commit is contained in:
1
types/pg/index.d.ts
vendored
1
types/pg/index.d.ts
vendored
@@ -16,6 +16,7 @@ export interface ConnectionConfig {
|
||||
port?: number;
|
||||
host?: string;
|
||||
connectionString?: string;
|
||||
keepAlive?: boolean;
|
||||
}
|
||||
|
||||
export interface Defaults extends ConnectionConfig {
|
||||
|
||||
@@ -9,6 +9,7 @@ const client = new Client({
|
||||
port: 5334,
|
||||
user: 'database-user',
|
||||
password: 'secretpassword!!',
|
||||
keepAlive: true,
|
||||
});
|
||||
client.connect(err => {
|
||||
if (err) {
|
||||
@@ -125,6 +126,7 @@ const pool = new Pool({
|
||||
max: 20,
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 2000,
|
||||
keepAlive: false,
|
||||
});
|
||||
console.log(pool.totalCount);
|
||||
pool.connect((err, client, done) => {
|
||||
|
||||
Reference in New Issue
Block a user