mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[Knex] add batch builder typedef for knex (#14760)
* add batch builder typedef for knex * fix spacing
This commit is contained in:
parent
c73a528e27
commit
c0948a79a2
4
knex/index.d.ts
vendored
4
knex/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
// Type definitions for Knex.js
|
||||
// Project: https://github.com/tgriesser/knex
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>, Baronfel <https://github.com/baronfel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@ -25,7 +25,7 @@ interface Knex extends Knex.QueryInterface {
|
||||
transaction: <R>(transactionScope: ((trx: Knex.Transaction) => void)) => Promise<any>;
|
||||
destroy(callback: Function): void;
|
||||
destroy(): Promise<void>;
|
||||
|
||||
batchInsert(tableName : TableName, data: any[], chunkSize : number) : Knex.QueryBuilder;
|
||||
schema: Knex.SchemaBuilder;
|
||||
|
||||
client: any;
|
||||
|
||||
@ -285,6 +285,8 @@ knex('books')
|
||||
.returning('id')
|
||||
.insert([{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}]);
|
||||
|
||||
knex.batchInsert('books', [{title:'Great Gatsby'}, {title: 'Fahrenheit 451'}], 200);
|
||||
|
||||
knex('books').where('published_date', '<', 2000).update({status: 'archived'});
|
||||
knex('books').where('published_date', '<', 2000).update({status: 'archived'}, 'id');
|
||||
knex('books').where('published_date', '<', 2000).update({status: 'archived'}, ['id', 'title']);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user