diff --git a/knex/index.d.ts b/knex/index.d.ts index 660a8dfcb2..15ff365756 100644 --- a/knex/index.d.ts +++ b/knex/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Knex.js // Project: https://github.com/tgriesser/knex -// Definitions by: Qubo +// Definitions by: Qubo , Baronfel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -25,7 +25,7 @@ interface Knex extends Knex.QueryInterface { transaction: (transactionScope: ((trx: Knex.Transaction) => void)) => Promise; destroy(callback: Function): void; destroy(): Promise; - + batchInsert(tableName : TableName, data: any[], chunkSize : number) : Knex.QueryBuilder; schema: Knex.SchemaBuilder; client: any; diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 3d02a7924b..6e49702faf 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -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']);