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

Function buildJoin

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

Source from the content-addressed store, hash-verified

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

Callers 1

buildFindOptionsFunction · 0.85

Calls 2

buildFindOptionsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected