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

Function buildNestedQuery

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

Source from the content-addressed store, hash-verified

1136 // toArray → toArray — both levels are plain arrays
1137 describe(`nested includes: Collection → Collection`, () => {
1138 function buildNestedQuery() {
1139 return createLiveQueryCollection((q) =>
1140 q.from({ p: projects }).select(({ p }) => ({
1141 id: p.id,
1142 name: p.name,
1143 issues: q
1144 .from({ i: issues })
1145 .where(({ i }) => eq(i.projectId, p.id))
1146 .select(({ i }) => ({
1147 id: i.id,
1148 title: i.title,
1149 comments: q
1150 .from({ c: comments })
1151 .where(({ c }) => eq(c.issueId, i.id))
1152 .select(({ c }) => ({
1153 id: c.id,
1154 body: c.body,
1155 })),
1156 })),
1157 })),
1158 )
1159 }
1160
1161 it(`supports two levels of includes`, async () => {
1162 const collection = buildNestedQuery()

Callers 1

includes.test.tsFile · 0.85

Calls 5

selectMethod · 0.80
fromMethod · 0.80
whereMethod · 0.80
eqFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…