knex: default batchInsert chunkSize arg (#23064)

* knex: optional batchInsert chunkSize arg

* knex: add test for optional batchInsert
This commit is contained in:
Omar Diab
2018-01-23 10:39:09 -08:00
committed by Andy
parent 8abd412a02
commit 398ebb9d76
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ interface Knex extends Knex.QueryInterface {
transaction<T>(transactionScope: (trx: Knex.Transaction) => Promise<T> | Bluebird<T> | void): Bluebird<T>;
destroy(callback: Function): void;
destroy(): Bluebird<void>;
batchInsert(tableName: TableName, data: any[], chunkSize: number): Knex.QueryBuilder;
batchInsert(tableName: TableName, data: any[], chunkSize?: number): Knex.QueryBuilder;
schema: Knex.SchemaBuilder;
queryBuilder(): Knex.QueryBuilder;
+1
View File
@@ -487,6 +487,7 @@ knex('books')
.insert([{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}]);
knex.batchInsert('books', [{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}], 200);
knex.batchInsert('books', [{title: 'Catcher In The Rye'}, {title: 'Pride And Prejudice'}]);
knex.queryBuilder().table('books');
knex('books').where('published_date', '<', 2000).update({status: 'archived'});