Add use method to Pool<T> that was added in generic-pool 3.3.0

This commit is contained in:
Matthew Douglass
2018-03-09 19:29:50 -08:00
parent 9bb6dc2f8b
commit 8e68a0155e
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -41,6 +41,9 @@ const opts = {
const pool = genericPool.createPool<Connection>(factory, opts);
pool.use((conn: Connection) => 'test')
.then((result: string) => { });
pool.acquire()
.then((conn: Connection) => {
return pool.release(conn);
+1
View File
@@ -22,6 +22,7 @@ export class Pool<T> extends EventEmitter {
destroy(resource: T): void;
drain(): PromiseLike<undefined>;
clear(): PromiseLike<undefined[]>;
use<U>(cb: (resource: T) => U): PromiseLike<U>;
}
export interface Factory<T> {