mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-22 20:37:58 +08:00
knex: add MySqlConnectionConfig, tests (#13161)
* knex: add MySqlConnectionConfig, tests * knex: add types for MySqlConnectionConfig queryFormat params
This commit is contained in:
@@ -36,6 +36,19 @@ var knex = Knex({
|
||||
}
|
||||
});
|
||||
|
||||
// Mysql configuration
|
||||
var knex = Knex({
|
||||
debug: true,
|
||||
client: 'mysql',
|
||||
connection: {
|
||||
host : '127.0.0.1',
|
||||
user : 'your_database_user',
|
||||
password : 'your_database_password',
|
||||
db : 'myapp_test',
|
||||
trace: false
|
||||
}
|
||||
});
|
||||
|
||||
// Pooling
|
||||
var knex = Knex({
|
||||
client: 'mysql',
|
||||
|
||||
28
knex/knex.d.ts
vendored
28
knex/knex.d.ts
vendored
@@ -455,7 +455,7 @@ declare module "knex" {
|
||||
client?: string;
|
||||
dialect?: string;
|
||||
connection?: string|ConnectionConfig|MariaSqlConnectionConfig|
|
||||
Sqlite3ConnectionConfig|SocketConnectionConfig;
|
||||
MySqlConnectionConfig|Sqlite3ConnectionConfig|SocketConnectionConfig;
|
||||
pool?: PoolConfig;
|
||||
migrations?: MigratorConfig;
|
||||
acquireConnectionTimeout?: number;
|
||||
@@ -503,6 +503,32 @@ declare module "knex" {
|
||||
rejectUnauthorized?: boolean;
|
||||
}
|
||||
|
||||
// Config object for mysql: https://github.com/mysqljs/mysql#connection-options
|
||||
interface MySqlConnectionConfig {
|
||||
host?: string;
|
||||
port?: number;
|
||||
localAddress?: string;
|
||||
socketPath?: string;
|
||||
user?: string;
|
||||
password?: string;
|
||||
database?: string;
|
||||
charset?: string;
|
||||
timezone?: string;
|
||||
connectTimeout?: number;
|
||||
stringifyObjects?: boolean;
|
||||
insecureAuth?: boolean;
|
||||
typeCast?: boolean;
|
||||
queryFormat?: (query: string, values: any) => string;
|
||||
supportBigNumbers?: boolean;
|
||||
bigNumberStrings?: boolean;
|
||||
dateStrings?: boolean;
|
||||
debug?: boolean;
|
||||
trace?: boolean;
|
||||
multipleStatements?: boolean;
|
||||
flags?: string;
|
||||
ssl?: string | MariaSslConfiguration;
|
||||
}
|
||||
|
||||
/** Used with SQLite3 adapter */
|
||||
interface Sqlite3ConnectionConfig {
|
||||
filename: string;
|
||||
|
||||
Reference in New Issue
Block a user