MCPcopy
hub / github.com/sequelize/sequelize / _whereJSON

Method _whereJSON

lib/dialects/abstract/query-generator.js:2461–2485  ·  lib/dialects/abstract/query-generator.js::QueryGenerator._whereJSON
(key, value, options)

Source from the content-addressed store, hash-verified

2459 }
2460
2461 _whereJSON(key, value, options) {
2462 const items = [];
2463 let baseKey = this.quoteIdentifier(key);
2464 if (options.prefix) {
2465 if (options.prefix instanceof Utils.Literal) {
2466 baseKey = `${this.handleSequelizeMethod(options.prefix)}.${baseKey}`;
2467 } else {
2468 baseKey = `${this.quoteTable(options.prefix)}.${baseKey}`;
2469 }
2470 }
2471
2472 Utils.getOperators(value).forEach(op => {
2473 const where = {
2474 [op]: value[op]
2475 };
2476 items.push(this.whereItemQuery(key, where, { ...options, json: false }));
2477 });
2478
2479 _.forOwn(value, (item, prop) => {
2480 this._traverseJSON(items, baseKey, prop, item, [prop]);
2481 });
2482
2483 const result = items.join(this.OperatorMap[Op.and]);
2484 return items.length > 1 ? `(${result})` : result;
2485 }
2486
2487 _traverseJSON(items, baseKey, prop, item, path) {
2488 let cast;

Callers 1

whereItemQueryMethod · 0.95

Calls 5

quoteIdentifierMethod · 0.95
handleSequelizeMethodMethod · 0.95
quoteTableMethod · 0.95
whereItemQueryMethod · 0.95
_traverseJSONMethod · 0.95

Tested by

no test coverage detected