mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
mysql: When configured Pool.config has different structure from what's expected at createPool() (#45860)
* When configured Pool.config has different structure from what's expected at createPool() * Test added
This commit is contained in:
parent
7ca8470413
commit
80ddbd163b
11
types/mysql/index.d.ts
vendored
11
types/mysql/index.d.ts
vendored
@ -189,7 +189,7 @@ export interface PoolConnection extends Connection {
|
||||
}
|
||||
|
||||
export interface Pool extends EscapeFunctions {
|
||||
config: PoolConfig;
|
||||
config: PoolActualConfig;
|
||||
|
||||
getConnection(callback: (err: MysqlError, connection: PoolConnection) => void): void;
|
||||
|
||||
@ -583,7 +583,7 @@ export interface ConnectionConfig extends ConnectionOptions {
|
||||
ssl?: string | (tls.SecureContextOptions & { rejectUnauthorized?: boolean });
|
||||
}
|
||||
|
||||
export interface PoolConfig extends ConnectionConfig {
|
||||
export interface PoolSpecificConfig {
|
||||
/**
|
||||
* The milliseconds before a timeout occurs during the connection acquisition. This is slightly different from connectTimeout,
|
||||
* because acquiring a pool connection does not always involve making a connection. (Default: 10 seconds)
|
||||
@ -609,6 +609,13 @@ export interface PoolConfig extends ConnectionConfig {
|
||||
queueLimit?: number;
|
||||
}
|
||||
|
||||
export interface PoolConfig extends PoolSpecificConfig, ConnectionConfig {
|
||||
}
|
||||
|
||||
export interface PoolActualConfig extends PoolSpecificConfig {
|
||||
connectionConfig: ConnectionConfig;
|
||||
}
|
||||
|
||||
export interface PoolClusterConfig {
|
||||
/**
|
||||
* If true, PoolCluster will attempt to reconnect when connection fails. (Default: true)
|
||||
|
||||
@ -184,6 +184,8 @@ const poolConfig = {
|
||||
|
||||
let pool = mysql.createPool(poolConfig);
|
||||
|
||||
console.log('Connection timezone config:', pool.config.connectionConfig.timezone);
|
||||
|
||||
pool.query('SELECT 1 + 1 AS solution', (err, rows, fields) => {
|
||||
if (err) throw err;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user