|
| 1 | +import * as mysql from './typings/mysql/index.js'; |
1 | 2 | import { |
2 | 3 | Connection as PromiseConnection, |
3 | 4 | Pool as PromisePool, |
4 | 5 | PoolConnection as PromisePoolConnection, |
5 | | -} from './promise'; |
| 6 | +} from './promise.js'; |
6 | 7 |
|
7 | | -import * as mysql from './typings/mysql'; |
8 | | -export * from './typings/mysql'; |
| 8 | +export * from './typings/mysql/index.js'; |
9 | 9 |
|
10 | 10 | export interface Connection extends mysql.Connection { |
11 | 11 | execute< |
@@ -72,7 +72,13 @@ export interface Connection extends mysql.Connection { |
72 | 72 | ): mysql.Query; |
73 | 73 | ping(callback?: (err: mysql.QueryError | null) => any): void; |
74 | 74 | unprepare(sql: string): mysql.PrepareStatementInfo; |
75 | | - prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare; |
| 75 | + prepare( |
| 76 | + sql: string, |
| 77 | + callback?: ( |
| 78 | + err: mysql.QueryError | null, |
| 79 | + statement: mysql.PrepareStatementInfo |
| 80 | + ) => any |
| 81 | + ): mysql.Prepare; |
76 | 82 | serverHandshake(args: any): any; |
77 | 83 | writeOk(args?: mysql.OkPacketParams): void; |
78 | 84 | writeError(args?: mysql.ErrorPacketParams): void; |
@@ -154,12 +160,19 @@ export interface Pool extends mysql.Connection { |
154 | 160 | callback: (err: NodeJS.ErrnoException, connection: PoolConnection) => any |
155 | 161 | ): void; |
156 | 162 | releaseConnection(connection: PoolConnection | PromisePoolConnection): void; |
| 163 | + on(event: string, listener: (args: any[]) => void): this; |
157 | 164 | on(event: 'connection', listener: (connection: PoolConnection) => any): this; |
158 | 165 | on(event: 'acquire', listener: (connection: PoolConnection) => any): this; |
159 | 166 | on(event: 'release', listener: (connection: PoolConnection) => any): this; |
160 | 167 | on(event: 'enqueue', listener: () => any): this; |
161 | 168 | unprepare(sql: string): mysql.PrepareStatementInfo; |
162 | | - prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare; |
| 169 | + prepare( |
| 170 | + sql: string, |
| 171 | + callback?: ( |
| 172 | + err: mysql.QueryError | null, |
| 173 | + statement: mysql.PrepareStatementInfo |
| 174 | + ) => any |
| 175 | + ): mysql.Prepare; |
163 | 176 | promise(promiseImpl?: PromiseConstructor): PromisePool; |
164 | 177 | config: mysql.PoolOptions; |
165 | 178 | } |
@@ -195,7 +208,14 @@ export interface ConnectionConfig extends ConnectionOptions { |
195 | 208 | getDefaultFlags(options?: ConnectionOptions): string[]; |
196 | 209 | getCharsetNumber(charset: string): number; |
197 | 210 | getSSLProfile(name: string): { ca: string[] }; |
198 | | - parseUrl(url: string): { host: string, port: number, database: string, user: string, password: string, [key: string]: any }; |
| 211 | + parseUrl(url: string): { |
| 212 | + host: string; |
| 213 | + port: number; |
| 214 | + database: string; |
| 215 | + user: string; |
| 216 | + password: string; |
| 217 | + [key: string]: any; |
| 218 | + }; |
199 | 219 | } |
200 | 220 |
|
201 | 221 | export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {} |
|
0 commit comments