MCPcopy Index your code
hub / github.com/TanStack/db / isCollectionReference

Function isCollectionReference

packages/db/src/query/optimizer.ts:296–314  ·  view source on GitHub ↗

* Determines if a source alias refers to a collection reference (not a subquery). * This is used to identify WHERE clauses that can be pushed down to collection subscriptions. * * @param query - The query to analyze * @param sourceAlias - The source alias to check * @returns True if the alias r

(query: QueryIR, sourceAlias: string)

Source from the content-addressed store, hash-verified

294 * @returns True if the alias refers to a collection reference
295 */
296function isCollectionReference(query: QueryIR, sourceAlias: string): boolean {
297 // Check the FROM clause
298 for (const source of getFromSources(query.from)) {
299 if (source.alias === sourceAlias) {
300 return source.type === `collectionRef`
301 }
302 }
303
304 // Check JOIN clauses
305 if (query.join) {
306 for (const joinClause of query.join) {
307 if (joinClause.from.alias === sourceAlias) {
308 return joinClause.from.type === `collectionRef`
309 }
310 }
311 }
312
313 return false
314}
315
316/**
317 * Returns the set of source aliases that are on the nullable side of outer joins.

Callers 1

Calls 1

getFromSourcesFunction · 0.70

Tested by

no test coverage detected