mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Knex - Add connection Client for extension.
This commit is contained in:
Vendored
+21
-2
@@ -1,6 +1,9 @@
|
||||
// Type definitions for Knex.js
|
||||
// Project: https://github.com/tgriesser/knex
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>, Baronfel <https://github.com/baronfel>, Pablo Rodríguez <https://github.com/MeLlamoPablo>
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Baronfel <https://github.com/baronfel>
|
||||
// Pablo Rodríguez <https://github.com/MeLlamoPablo>
|
||||
// Matt R. Wilson <https://github.com/mastermatt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -510,7 +513,7 @@ declare namespace Knex {
|
||||
|
||||
interface Config {
|
||||
debug?: boolean;
|
||||
client?: string;
|
||||
client?: string | typeof Client;
|
||||
dialect?: string;
|
||||
version?: string;
|
||||
connection?: string | ConnectionConfig | MariaSqlConnectionConfig |
|
||||
@@ -676,6 +679,22 @@ declare namespace Knex {
|
||||
interface FunctionHelper {
|
||||
now(): Raw;
|
||||
}
|
||||
|
||||
//
|
||||
// Clients
|
||||
//
|
||||
|
||||
class Client extends events.EventEmitter {
|
||||
constructor(config: Config);
|
||||
config: Config;
|
||||
dialect: string;
|
||||
driverName: string;
|
||||
connectionSettings: object;
|
||||
|
||||
acquireRawConnection(): Promise<any>;
|
||||
destroyRawConnection(connection: any): Promise<void>;
|
||||
validateConnection(connection: any): Promise<boolean>;
|
||||
}
|
||||
}
|
||||
|
||||
export = Knex;
|
||||
|
||||
@@ -128,6 +128,13 @@ var knex = Knex({
|
||||
useNullAsDefault: true,
|
||||
});
|
||||
|
||||
// Using custom client
|
||||
class TestClient extends Knex.Client {}
|
||||
|
||||
var knex = Knex({
|
||||
client: TestClient,
|
||||
});
|
||||
|
||||
knex('books').insert({title: 'Test'}).returning('*').toString();
|
||||
|
||||
// Migrations
|
||||
|
||||
Reference in New Issue
Block a user