MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / buildJoin

Function buildJoin

packages/core/fumadb/src/query/orm/index.ts:68–91  ·  view source on GitHub ↗
(
  table: AnyTable,
  fn: (builder: JoinBuilder<T, {}>) => JoinBuilder<T, unknown>,
)

Source from the content-addressed store, hash-verified

66}
67
68function buildJoin<T extends AnyTable>(
69 table: AnyTable,
70 fn: (builder: JoinBuilder<T, {}>) => JoinBuilder<T, unknown>,
71): CompiledJoin[] {
72 const compiled: CompiledJoin[] = [];
73 const builder: Record<string, unknown> = {};
74
75 for (const name in table.relations) {
76 const relation = table.relations[name]!;
77
78 builder[name] = (options: FindFirstOptions | FindManyOptions = {}) => {
79 compiled.push({
80 relation,
81 options: buildFindOptions(relation.table, options),
82 });
83
84 delete builder[name];
85 return builder;
86 };
87 }
88
89 fn(builder as JoinBuilder<T, {}>);
90 return compiled;
91}
92
93export type SimplifyFindOptions<O> = Omit<
94 O,

Callers 1

buildFindOptionsFunction · 0.85

Calls 2

buildFindOptionsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected