-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.d.ts
82 lines (71 loc) · 4.71 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { Connection as PromiseConnection, Pool as PromisePool, PoolConnection as PromisePoolConnection } from './promise';
import * as mysql from 'mysql';
export * from 'mysql';
export interface Connection extends mysql.Connection {
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(sql: string, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(options: mysql.QueryOptions, callback?: (err: mysql.QueryError | null, result: T, fields?: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(options: mysql.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
ping(callback?: (err: mysql.QueryError | null) => any): void;
promise(promiseImpl?: PromiseConstructor): PromiseConnection;
}
export interface PoolConnection extends mysql.PoolConnection, Connection {
promise(promiseImpl?: PromiseConstructor): PromisePoolConnection;
}
export interface Pool extends mysql.Connection {
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(sql: string, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(sql: string, values: any | any[] | { [param: string]: any }, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(options: mysql.QueryOptions, callback?: (err: mysql.QueryError | null, result: T, fields?: mysql.FieldPacket[]) => any): mysql.Query;
execute<T extends mysql.RowDataPacket[][] | mysql.RowDataPacket[] | mysql.OkPacket | mysql.OkPacket[] | mysql.ResultSetHeader>(options: mysql.QueryOptions, values: any | any[] | { [param: string]: any }, callback?: (err: mysql.QueryError | null, result: T, fields: mysql.FieldPacket[]) => any): mysql.Query;
getConnection(callback: (err: NodeJS.ErrnoException, connection: PoolConnection) => any): void;
releaseConnection(connection: PoolConnection): void;
end(callback?: (err: mysql.QueryError) => any): void;
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
on(event: 'release', listener: (connection: PoolConnection) => any): this;
on(event: 'enqueue', listener: () => any): this;
promise(promiseImpl?: PromiseConstructor): PromisePool;
}
export interface ConnectionOptions extends mysql.ConnectionOptions {
charsetNumber?: number;
compress?: boolean;
authSwitchHandler?: (data: any, callback: () => void) => any;
connectAttributes?: { [param: string]: any };
decimalNumbers?: boolean;
isServer?: boolean;
maxPreparedStatements?: number;
namedPlaceholders?: boolean;
nestTables?: boolean | string;
passwordSha1?: string;
pool?: any;
rowsAsArray?: boolean;
stream?: any;
uri?: string;
connectionLimit?: number;
Promise?: any;
queueLimit?: number;
waitForConnections?: boolean;
}
export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {}
export interface FieldPacket extends mysql.FieldPacket {
columnType: number
columnLength: number
schema: string
characterSet: number
}
type authPlugins =
(pluginMetadata: { connection: Connection; command: string }) =>
(pluginData: Buffer) => Promise<string>;
export interface ConnectionOptions extends mysql.ConnectionOptions {
authPlugins?: {
[key: string]: authPlugins;
};
}
export interface PoolOptions extends mysql.PoolOptions {
authPlugins?: {
[key: string]: authPlugins;
};
}
export function createConnection(connectionUri: string): Connection;
export function createConnection(config: ConnectionOptions): Connection;
export function createPool(config: PoolOptions | string): Pool;