1 | import { EventEmitter } from 'events';
|
2 | import { PrepareStatementInfo } from './protocol/sequences/Prepare.js';
|
3 | import { ConnectionOptions } from './Connection.js';
|
4 | import { PoolConnection } from './PoolConnection.js';
|
5 | import {
|
6 | Pool as PromisePool,
|
7 | PoolConnection as PromisePoolConnection,
|
8 | } from '../../../promise.js';
|
9 | import { QueryableBase } from './protocol/sequences/QueryableBase.js';
|
10 | import { ExecutableBase } from './protocol/sequences/ExecutableBase.js';
|
11 |
|
12 | export interface PoolOptions extends ConnectionOptions {
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 | waitForConnections?: boolean;
|
19 |
|
20 | |
21 |
|
22 |
|
23 | connectionLimit?: number;
|
24 |
|
25 | |
26 |
|
27 |
|
28 | maxIdle?: number;
|
29 |
|
30 | |
31 |
|
32 |
|
33 | idleTimeout?: number;
|
34 |
|
35 | |
36 |
|
37 |
|
38 |
|
39 | queueLimit?: number;
|
40 | }
|
41 |
|
42 | declare class Pool extends QueryableBase(ExecutableBase(EventEmitter)) {
|
43 | getConnection(
|
44 | callback: (
|
45 | err: NodeJS.ErrnoException | null,
|
46 | connection: PoolConnection,
|
47 | ) => any,
|
48 | ): void;
|
49 |
|
50 | releaseConnection(connection: PoolConnection | PromisePoolConnection): void;
|
51 |
|
52 | end(
|
53 | callback?: (err: NodeJS.ErrnoException | null, ...args: any[]) => any,
|
54 | ): void;
|
55 |
|
56 | on(event: string, listener: (...args: any[]) => void): this;
|
57 | on(event: 'connection', listener: (connection: PoolConnection) => any): this;
|
58 | on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
|
59 | on(event: 'release', listener: (connection: PoolConnection) => any): this;
|
60 | on(event: 'enqueue', listener: () => any): this;
|
61 |
|
62 | unprepare(sql: string): PrepareStatementInfo;
|
63 |
|
64 | promise(promiseImpl?: PromiseConstructor): PromisePool;
|
65 |
|
66 | config: PoolOptions;
|
67 | }
|
68 |
|
69 | export { Pool };
|