knex-on-duplicate-update
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,5 +0,5 @@ | ||
const KnexQueryBuilder = require('knex/lib/query/builder'); | ||
const Knex = require('knex'); | ||
module.exports.attachOnDuplicateUpdate = function attachOnDuplicateUpdate() { | ||
KnexQueryBuilder.prototype.onDuplicateUpdate = function (...columns) { | ||
Knex.QueryBuilder.extend('onDuplicateUpdate', function onDuplicateUpdate(...columns) { | ||
if (this._method !== 'insert') { | ||
@@ -34,3 +34,3 @@ throw new Error('onDuplicateUpdate error: should be used only with insert query.'); | ||
const newBindings = [ ...originalBindings, ...bindings ]; | ||
const newBindings = [...originalBindings, ...bindings]; | ||
@@ -41,3 +41,3 @@ return this.client.raw( | ||
); | ||
}; | ||
}); | ||
}; |
{ | ||
"name": "knex-on-duplicate-update", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Simple patcher for Knex. It adds the .onDuplicateUpdate() function to knex's query builder.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
5134