@dialexa/knex-plus
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -17,3 +17,7 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_get_1 = __importDefault(require("lodash.get")); | ||
const change_case_1 = require("./change-case"); | ||
@@ -29,4 +33,11 @@ class Repository { | ||
const cols = change_case_1.snakeCase(fields || "*"); | ||
const ids = yield this.qb.insert(obj); | ||
const records = yield this.where({ id: ids }).select(cols); | ||
let records = []; | ||
const dialect = lodash_get_1.default(this.knex, ['client', 'config', 'dialect'], 'sqlite3'); | ||
if (dialect === 'sqlite3') { | ||
const ids = yield this.qb.insert(obj); | ||
records = yield this.where({ id: ids }).select(cols); | ||
} | ||
else { | ||
records = yield this.qb.insert(obj, cols); | ||
} | ||
return change_case_1.camelCase(records); | ||
@@ -33,0 +44,0 @@ }); |
{ | ||
"name": "@dialexa/knex-plus", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A lightweight repository library powered by knex", | ||
@@ -49,2 +49,3 @@ "main": "dist/index.js", | ||
"lodash.camelcase": "~4.3.0", | ||
"lodash.get": "~4.4.2", | ||
"lodash.mapkeys": "~4.6.0", | ||
@@ -51,0 +52,0 @@ "lodash.snakecase": "~4.1.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17687
350
5
+ Addedlodash.get@~4.4.2
+ Addedlodash.get@4.4.2(transitive)