mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Make connection optional for knex Config
It is possible to use knex as a pure query builder without any database connection. This is specified in the knex documentation.
This commit is contained in:
@@ -55,6 +55,16 @@ var knex = Knex({
|
||||
}
|
||||
});
|
||||
|
||||
// Pure Query Builder without a connection
|
||||
var knex = Knex({});
|
||||
|
||||
// Pure Query Builder without a connection, using a specific flavour of SQL
|
||||
var knex = Knex({
|
||||
client: 'pg'
|
||||
});
|
||||
|
||||
knex('books').insert({title: 'Test'}).returning('*').toString();
|
||||
|
||||
// Migrations
|
||||
var knex = Knex({
|
||||
client: 'mysql',
|
||||
|
||||
2
knex/knex.d.ts
vendored
2
knex/knex.d.ts
vendored
@@ -409,7 +409,7 @@ declare module "knex" {
|
||||
debug?: boolean;
|
||||
client?: string;
|
||||
dialect?: string;
|
||||
connection: string|ConnectionConfig|MariaSqlConnectionConfig|
|
||||
connection?: string|ConnectionConfig|MariaSqlConnectionConfig|
|
||||
Sqlite3ConnectionConfig|SocketConnectionConfig;
|
||||
pool?: PoolConfig;
|
||||
migrations?: MigrationConfig;
|
||||
|
||||
Reference in New Issue
Block a user