MCPcopy Create free account
hub / github.com/TanStack/db / getRefFromAlias

Function getRefFromAlias

packages/db/src/query/ir.ts:302–321  ·  view source on GitHub ↗
(
  query: QueryIR,
  alias: string,
)

Source from the content-addressed store, hash-verified

300}
301
302function getRefFromAlias(
303 query: QueryIR,
304 alias: string,
305): CollectionRef | QueryRef | void {
306 if (query.from.type === `unionFrom`) {
307 for (const source of query.from.sources) {
308 if (source.alias === alias) {
309 return source
310 }
311 }
312 } else if (query.from.type !== `unionAll` && query.from.alias === alias) {
313 return query.from
314 }
315
316 for (const join of query.join || []) {
317 if (join.from.alias === alias) {
318 return join.from
319 }
320 }
321}
322
323/**
324 * Follows the given reference in a query

Callers 1

followRefFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected