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

Function buildAggregateQuery

packages/db/tests/query/includes.test.ts:3871–3882  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3869 describe(`aggregates in child queries`, () => {
3870 describe(`single-group aggregate: count issues per project (as Collection)`, () => {
3871 function buildAggregateQuery() {
3872 return createLiveQueryCollection((q) =>
3873 q.from({ p: projects }).select(({ p }) => ({
3874 id: p.id,
3875 name: p.name,
3876 issueCount: q
3877 .from({ i: issues })
3878 .where(({ i }) => eq(i.projectId, p.id))
3879 .select(({ i }) => ({ total: count(i.id) })),
3880 })),
3881 )
3882 }
3883
3884 it(`each project gets its own aggregate result`, async () => {
3885 const collection = buildAggregateQuery()

Callers 1

includes.test.tsFile · 0.85

Calls 6

selectMethod · 0.80
fromMethod · 0.80
whereMethod · 0.80
eqFunction · 0.70
countFunction · 0.50

Tested by

no test coverage detected