Browse Source

Merge branch 'master' of github.com:harish2704/knex-json-query

* 'master' of github.com:harish2704/knex-json-query:
  Fix for column names in raw
master
Harish Karumuthil 4 years ago
parent
commit
b7438e04b7
  1. 1
      .gitignore
  2. 4
      index.js

1
.gitignore

@ -36,3 +36,4 @@ jspm_packages
# Optional REPL history # Optional REPL history
.node_repl_history .node_repl_history
.vscode/* .vscode/*
.idea

4
index.js

@ -57,7 +57,7 @@ function addCondition (q, field, val) {
return val.forEach(addCondition.bind(null, this, field)); return val.forEach(addCondition.bind(null, this, field));
}); });
} }
if (!Array.isArray(val)) { if (!Array.isArray(val)) {
// Simple string or number value // Simple string or number value
val = ['AND', field, val ]; val = ['AND', field, val ];
@ -78,7 +78,7 @@ function addCondition (q, field, val) {
} }
} }
} }
var args = val[0].includes('RAW') ? [ '"'+val[1]+'" ' + val[2] ] : val.slice(1)
var args = val[0].includes('RAW') ? [ q.client.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