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

Method _whereJSON

src/dialects/abstract/query-generator.js:2638–2662  ·  view source on GitHub ↗
(key, value, options)

Source from the content-addressed store, hash-verified

2636 }
2637
2638 _whereJSON(key, value, options) {
2639 const items = [];
2640 let baseKey = this.quoteIdentifier(key);
2641 if (options.prefix) {
2642 if (options.prefix instanceof Utils.Literal) {
2643 baseKey = `${this.handleSequelizeMethod(options.prefix)}.${baseKey}`;
2644 } else {
2645 baseKey = `${this.quoteTable(options.prefix)}.${baseKey}`;
2646 }
2647 }
2648
2649 Utils.getOperators(value).forEach(op => {
2650 const where = {
2651 [op]: value[op]
2652 };
2653 items.push(this.whereItemQuery(key, where, { ...options, json: false }));
2654 });
2655
2656 _.forOwn(value, (item, prop) => {
2657 this._traverseJSON(items, baseKey, prop, item, [prop]);
2658 });
2659
2660 const result = items.join(this.OperatorMap[Op.and]);
2661 return items.length > 1 ? `(${result})` : result;
2662 }
2663
2664 _traverseJSON(items, baseKey, prop, item, path) {
2665 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