Merge pull request #16740 from ughitsaaron/pg-add-promise

Add Promise property to PoolConfig for @types/pg
This commit is contained in:
Yui
2017-06-01 07:27:53 -07:00
committed by GitHub
2 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -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>;
+2
View File
@@ -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);