mythix-orm 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,16 +4,21 @@ const Nife = require('nife');
|
|
|
4
4
|
const ProxyClass = require('../proxy-class');
|
|
5
5
|
const QueryEngineBase = require('./query-engine-base');
|
|
6
6
|
|
|
7
|
-
function addOperatorToQuery(name, inverseName, value) {
|
|
7
|
+
function addOperatorToQuery(name, inverseName, value, extraOptions) {
|
|
8
8
|
if (Nife.instanceOf(value, 'object'))
|
|
9
9
|
throw new Error(`QueryEngine::addOperatorToQuery: ${name}(${value}) makes no sense...`);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let conditionalParams = {
|
|
12
12
|
condition: true,
|
|
13
13
|
operator: name,
|
|
14
14
|
inverseOperator: inverseName,
|
|
15
15
|
value: this._fetchOperatorValue(value),
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (extraOptions)
|
|
19
|
+
conditionalParams = Object.assign(conditionalParams, extraOptions);
|
|
20
|
+
|
|
21
|
+
this._addToQuery(conditionalParams);
|
|
17
22
|
|
|
18
23
|
return this._fetchScope('model');
|
|
19
24
|
}
|
|
@@ -83,12 +88,14 @@ class FieldScope extends QueryEngineBase {
|
|
|
83
88
|
return addOperatorToQuery.call(this, 'LTE', 'GT', value);
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
LIKE(value) {
|
|
87
|
-
|
|
91
|
+
LIKE(value, options) {
|
|
92
|
+
let caseSensitive = ((options && options.caseSensitive) === true);
|
|
93
|
+
return addOperatorToQuery.call(this, 'LIKE', 'NOT_LIKE', value, { caseSensitive });
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
NOT_LIKE(value) {
|
|
91
|
-
|
|
96
|
+
NOT_LIKE(value, options) {
|
|
97
|
+
let caseSensitive = ((options && options.caseSensitive) === true);
|
|
98
|
+
return addOperatorToQuery.call(this, 'NOT_LIKE', 'LIKE', value, { caseSensitive });
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
[ProxyClass.MISSING](target, prop) {
|