Add types for connection config of mysql2 driver (#4144)

This commit is contained in:
Kenny 2020-12-08 05:46:28 +09:00 committed by GitHub
parent bad1ea714d
commit 073df48cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

21
types/index.d.ts vendored
View File

@ -16,6 +16,7 @@ import ResultTypes = require('./result');
import { Tables } from './tables';
import { ConnectionOptions } from "tls";
import { Stream } from "stream";
// # Generic type-level utilities
@ -1843,6 +1844,7 @@ declare namespace Knex {
| ConnectionConfig
| MariaSqlConnectionConfig
| MySqlConnectionConfig
| MySql2ConnectionConfig
| MsSqlConnectionConfig
| OracleDbConnectionConfig
| PgConnectionConfig
@ -1972,6 +1974,25 @@ declare namespace Knex {
expirationChecker?(): boolean;
}
// Config object for mysql2: https://github.com/sidorares/node-mysql2/blob/master/lib/connection_config.js
// Some options for connection pooling and MySQL server API are excluded.
interface MySql2ConnectionConfig extends MySqlConnectionConfig {
authPlugins?: {[pluginName: string]: (pluginMetadata: any) => ((pluginData: any) => any)};
authSwitchHandler?: (data: any, callback: () => void) => any;
charsetNumber?: number;
compress?: boolean;
connectAttributes?: {[attrNames: string]: any};
enableKeepAlive?: boolean;
keepAliveInitialDelay?: number;
maxPreparedStatements?: number;
namedPlaceholders?: boolean;
nestTables?: boolean | string;
passwordSha1?: string;
rowsAsArray?: boolean;
stream?: boolean | ((opts: any) => Stream) | Stream;
uri?: string;
}
interface OracleDbConnectionConfig {
host: string;
user: string;