-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Description
The data shown in a user interface if often hierarchical (projects -> issues -> comments)
The joins supported by Tanstack DB are SQL like joins where the resulting rows are flat, however users will often what to project to a hierarchical structure to render in the UI.
The proposed syntax is to use subqueries in the select clause:
const projects = new Query
.from({ project: projectsCllctn })
.where(....)
.select(({ project }) => ({
project,
issues: new Query
.from({ issue: issuesCllctn })
.where(({ issue }) =>
eq(issue.projectId, project.id)
)
.select(({ issue }) => ({
issue,
comments: new Query
.from({ comment: commentsCllctn })
.where(({ comment }) =>
eq(comment.issueId, issue.id)
)
})
})eigilnikolajsen, tomkuehl, byudaniel, mxsdev, hanneskuettner and 61 morelirbank, HaleyBoles, mhsnook, alex-zwingli, MAST1999 and 10 more
Metadata
Metadata
Assignees
Labels
No labels