mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #16740 from ughitsaaron/pg-add-promise
Add Promise property to PoolConfig for @types/pg
This commit is contained in:
Vendored
+2
-1
@@ -42,6 +42,7 @@ export interface PoolConfig extends ClientConfig {
|
||||
reapIntervalMillis?: number;
|
||||
returnToHead?: boolean;
|
||||
application_name?: string;
|
||||
Promise?: PromiseConstructorLike;
|
||||
}
|
||||
|
||||
export interface QueryConfig {
|
||||
@@ -71,7 +72,7 @@ export declare class Pool extends events.EventEmitter {
|
||||
connect(callback: (err: Error, client: Client, done: () => void) => void): void;
|
||||
|
||||
end(): Promise<void>;
|
||||
|
||||
|
||||
query(queryStream: QueryConfig & stream.Readable): stream.Readable;
|
||||
query(queryTextOrConfig: string | QueryConfig): Promise<QueryResult>;
|
||||
query(queryText: string, values: any[]): Promise<QueryResult>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import * as pg from "pg";
|
||||
import * as bluebird from "bluebird";
|
||||
|
||||
var conString = "postgres://username:password@localhost/database";
|
||||
|
||||
@@ -54,6 +55,7 @@ var config = {
|
||||
port: 5432, //env var: PGPORT
|
||||
max: 10, // max number of clients in the pool
|
||||
idleTimeoutMillis: 30000, // how long a client is allowed to remain idle before being closed
|
||||
Promise: bluebird
|
||||
};
|
||||
var pool = new pg.Pool(config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user