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

Function selectHasAggregates

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

* Detects whether a SELECT projection contains any aggregate expressions. * Recursively traverses nested select objects. * * @param select - The SELECT object from the IR * @returns True if any field is an aggregate, false otherwise

(select: Select)

Source from the content-addressed store, hash-verified

1064 * @returns True if any field is an aggregate, false otherwise
1065 */
1066function selectHasAggregates(select: Select): boolean {
1067 for (const value of Object.values(select)) {
1068 if (typeof value === `object`) {
1069 const v: any = value
1070 if (v.type === `agg`) return true
1071 if (!(`type` in v)) {
1072 if (selectHasAggregates(v as unknown as Select)) return true
1073 }
1074 }
1075 }
1076 return false
1077}
1078
1079/**
1080 * Recursively collects all PropRef references from an expression.

Callers 1

unsafeSelectFunction · 0.85

Calls 1

valuesMethod · 0.45

Tested by

no test coverage detected