Skip to content

Commit f53cafb

Browse files
committed
fix: update pool cluster of to use pool namespace
pool_cluster.js was out of sync with the typing and returns a pool namespace rather than a self reference pool cluster
1 parent db91252 commit f53cafb

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

typings/mysql/lib/PoolCluster.d.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import PoolConnection = require('./PoolConnection');
33
import {EventEmitter} from 'events';
44
import {PoolOptions} from './Pool';
5+
import {OkPacket, RowDataPacket, FieldPacket, ResultSetHeader} from './protocol/packets/index';
6+
import Query = require('./protocol/sequences/Query');
57

68
declare namespace PoolCluster {
79

@@ -31,6 +33,20 @@ declare namespace PoolCluster {
3133
*/
3234
defaultSelector?: string;
3335
}
36+
37+
export interface PoolNamespace {
38+
getConnection(callback: (err: NodeJS.ErrnoException | null, connection: PoolConnection) => any): void;
39+
40+
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
41+
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
42+
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
43+
query<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
44+
45+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
46+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
47+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, callback?: (err: Query.QueryError | null, result: T, fields?: FieldPacket[]) => any): Query;
48+
execute<T extends RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader>(options: Query.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: Query.QueryError | null, result: T, fields: FieldPacket[]) => any): Query;
49+
}
3450
}
3551

3652
declare class PoolCluster extends EventEmitter {
@@ -46,11 +62,11 @@ declare class PoolCluster extends EventEmitter {
4662
getConnection(group: string, callback: (err: NodeJS.ErrnoException | null, connection: PoolConnection) => void): void;
4763
getConnection(group: string, selector: string, callback: (err: NodeJS.ErrnoException | null, connection: PoolConnection) => void): void;
4864

49-
of(pattern: string, selector?: string): PoolCluster;
65+
of(pattern: string, selector?: string): PoolCluster.PoolNamespace;
5066

5167
on(event: string, listener: Function): this;
5268
on(event: 'remove', listener: (nodeId: number) => void): this;
5369
on(event: 'connection', listener: (connection: PoolConnection) => void): this;
5470
}
5571

56-
export = PoolCluster;
72+
export = PoolCluster

0 commit comments

Comments
 (0)