MCPcopy Create free account
hub / github.com/dresende/node-orm2 / chainQuery

Function chainQuery

lib/Validators.js:75–88  ·  view source on GitHub ↗
(prop, value)

Source from the content-addressed store, hash-verified

73 var chain = ctx.model.find();
74
75 var chainQuery = function (prop, value) {
76 var query = null;
77
78 if (opts.ignoreCase === true && ctx.model.properties[prop] && ctx.model.properties[prop].type === 'text') {
79 query = util.format('LOWER(%s.%s) LIKE LOWER(?)',
80 ctx.driver.query.escapeId(ctx.model.table), ctx.driver.query.escapeId(prop)
81 );
82 chain.where(query, [value]);
83 } else {
84 query = {};
85 query[prop] = value;
86 chain.where(query);
87 }
88 };
89
90 var handler = function (err, records) {
91 if (err) {

Callers 1

Validators.jsFile · 0.85

Calls 1

whereMethod · 0.65

Tested by

no test coverage detected