|
8 | 8 | QueryOptions,
|
9 | 9 | ConnectionOptions,
|
10 | 10 | PoolOptions,
|
| 11 | + PoolClusterOptions, |
11 | 12 | Pool as CorePool,
|
12 | 13 | } from './index.js';
|
13 | 14 | import { ExecutableBase as ExecutableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/ExecutableBase.js';
|
@@ -95,10 +96,36 @@ export interface Pool extends Connection {
|
95 | 96 | pool: CorePool;
|
96 | 97 | }
|
97 | 98 |
|
| 99 | +export interface PoolNamespace extends QueryableAndExecutableBase { |
| 100 | + getConnection(): Promise<PoolConnection>; |
| 101 | +} |
| 102 | + |
| 103 | +export interface PoolCluster extends EventEmitter { |
| 104 | + config: PoolClusterOptions; |
| 105 | + |
| 106 | + add(config: PoolOptions): void; |
| 107 | + add(group: string, connectionUri: string): void; |
| 108 | + add(group: string, config: PoolOptions): void; |
| 109 | + |
| 110 | + end(): Promise<void>; |
| 111 | + |
| 112 | + getConnection(): Promise<PoolConnection>; |
| 113 | + getConnection(group: string): Promise<PoolConnection>; |
| 114 | + getConnection(group: string, selector: string): Promise<PoolConnection>; |
| 115 | + |
| 116 | + of(pattern: string, selector?: string): PoolNamespace; |
| 117 | + |
| 118 | + on(event: string, listener: (args: any[]) => void): this; |
| 119 | + on(event: 'remove', listener: (nodeId: number) => void): this; |
| 120 | + on(event: 'connection', listener: (connection: PoolConnection) => void): this; |
| 121 | +} |
| 122 | + |
98 | 123 | export function createConnection(connectionUri: string): Promise<Connection>;
|
99 | 124 | export function createConnection(
|
100 | 125 | config: ConnectionOptions
|
101 | 126 | ): Promise<Connection>;
|
102 | 127 |
|
103 | 128 | export function createPool(connectionUri: string): Pool;
|
104 | 129 | export function createPool(config: PoolOptions): Pool;
|
| 130 | + |
| 131 | +export function createPoolCluster(config?: PoolClusterOptions): PoolCluster; |
0 commit comments