think-model
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -9,3 +9,3 @@ const helper = require('think-helper'); | ||
const Cls = models[name] || Model; | ||
const modelName = path.basename(name); | ||
const modelName = name ? path.basename(name) : name; | ||
const instance = new Cls(modelName, config); | ||
@@ -12,0 +12,0 @@ // add models in config, it's need in model when get relation model instance |
@@ -786,3 +786,2 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
[QUOTE_FIELD](field) { | ||
field = field || this.pk; | ||
if (field) return this.db().parseKey(field); | ||
@@ -789,0 +788,0 @@ return '*'; |
{ | ||
"name": "think-model", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "An adapter-based ORM for ThinkJS 3.x", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -761,3 +761,3 @@ const {test} = require('ava'); | ||
model.getField = function(sql) { | ||
t.is(sql, `${logic.toUpperCase()}(id) AS think_${logic}`); | ||
t.is(sql, `${logic.toUpperCase()}(*) AS think_${logic}`); | ||
}; | ||
@@ -771,3 +771,3 @@ model[logic](); | ||
model.getField = function(sql) { | ||
t.is(sql, `${logic.toUpperCase()}(post_id) AS think_${logic}`); | ||
t.is(sql, `${logic.toUpperCase()}(*) AS think_${logic}`); | ||
}; | ||
@@ -774,0 +774,0 @@ model[logic](); |
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
158482
5634