MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / buildBaseSelect

Function buildBaseSelect

packages/plugins/policy/src/functions.ts:45–56  ·  view source on GitHub ↗
(baseModel: string, field: string)

Source from the content-addressed store, hash-verified

43
44 // helper to build a base model select for delegate models
45 const buildBaseSelect = (baseModel: string, field: string): Expression<any> => {
46 return eb
47 .selectFrom(baseModel)
48 .select(field)
49 .where(
50 eb.and(
51 idFields.map((idField) =>
52 eb(eb.ref(`${fieldDef.originModel}.${idField}`), '=', eb.ref(`${modelAlias}.${idField}`)),
53 ),
54 ),
55 );
56 };
57
58 if (fkInfo.ownedByModel) {
59 // model owns the relation

Callers 1

checkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected