Browse Source

Add or_raw statement

pull/2/head
joselcvarela 7 years ago
parent
commit
d96011dc19
  1. 6
      index.js

6
index.js

@ -26,7 +26,9 @@ var functionOperatorMap = {
AND_ISNULL: 'andWhereNull', AND_ISNULL: 'andWhereNull',
AND_NOTNULL: 'andWhereNotNull', AND_NOTNULL: 'andWhereNotNull',
/* ---- */ /* ---- */
RAW: 'whereRaw'
RAW: 'whereRaw',
OR_RAW: 'orWhereRaw',
AND_RAW: 'whereRaw',
}; };
var aliases = { var aliases = {
@ -64,7 +66,7 @@ function addCondition (q, field, val) {
val = [ 'AND', field ].concat(val); val = [ 'AND', field ].concat(val);
} }
} }
var args = val[0] === 'RAW' ? [ '"'+val[1]+'" ' + val[2] ] : val.slice(1)
var args = val[0].includes('RAW') ? [ '"'+val[1]+'" ' + val[2] ] : val.slice(1)
return q[functionOperatorMap[val[0]]].apply(q, args); return q[functionOperatorMap[val[0]]].apply(q, args);
} }

Loading…
Cancel
Save