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

Function eagerQuery

lib/Drivers/DML/_shared.js:21–37  ·  view source on GitHub ↗
(association, opts, keys, cb)

Source from the content-addressed store, hash-verified

19};
20
21var eagerQuery = function (association, opts, keys, cb) {
22 var desiredKey = Object.keys(association.field);
23 var assocKey = Object.keys(association.mergeAssocId);
24
25 var where = {};
26 where[desiredKey] = keys;
27
28 var query = this.query.select()
29 .from(association.model.table)
30 .select(opts.only)
31 .from(association.mergeTable, assocKey, opts.keys)
32 .select(desiredKey).as("$p")
33 .where(association.mergeTable, where)
34 .build();
35
36 this.execSimpleQuery(query, cb);
37};
38
39module.exports = {
40 generateQuery: generateQuery,

Callers

nothing calls this directly

Calls 5

buildMethod · 0.65
whereMethod · 0.65
asMethod · 0.65
selectMethod · 0.65
fromMethod · 0.65

Tested by

no test coverage detected