Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

think-model

Package Overview
Dependencies
Maintainers
8
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

think-model - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

7

lib/relation/base.js

@@ -19,4 +19,5 @@ const helper = require('think-helper');

* parse where in relation model
* @param {String} prefix prefix for table alia name
*/
parseRelationWhere() {
parseRelationWhere(prefix = '') {
const { key, fKey } = this.options;

@@ -33,3 +34,3 @@ if (helper.isArray(this.data)) {

return {
[fKey]: ['IN', keys]
[prefix + fKey]: ['IN', keys]
};

@@ -39,3 +40,3 @@ }

return {
[fKey]: this.data[key]
[prefix + fKey]: this.data[key]
};

@@ -42,0 +43,0 @@ }

@@ -23,3 +23,3 @@ 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"); }); }; }

return _asyncToGenerator(function* () {
const where = _this.parseRelationWhere();
const where = _this.parseRelationWhere('b.');
if (where === false) return _this.data;

@@ -26,0 +26,0 @@ const relationModel = _this.options.rModel || _this.getRelationModelName();

{
"name": "think-model",
"version": "1.5.3",
"version": "1.5.4",
"description": "An adapter-based ORM for ThinkJS 3.x",

@@ -5,0 +5,0 @@ "scripts": {

@@ -65,3 +65,3 @@ const {test} = require('ava');

relation.options.model.select = function() {
t.deepEqual(this.options, {'field': '*,b.post_id', 'fieldReverse': false, 'alias': 'a', 'where': {'post_id': ['IN', [3, 10]]}, 'join': [{'post_user': {'table': 'relationModel', 'as': 'b', 'join': 'inner', 'on': ['id', 'user_id']}}]});
t.deepEqual(this.options, {'field': '*,b.post_id', 'fieldReverse': false, 'alias': 'a', 'where': {'b.post_id': ['IN', [3, 10]]}, 'join': [{'post_user': {'table': 'relationModel', 'as': 'b', 'join': 'inner', 'on': ['id', 'user_id']}}]});
return [

@@ -68,0 +68,0 @@ {name: 'lizheming', post_id: 10},

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc