-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Task
Implement the ?include= query parameter for eager loading in Go/sqlc.
Endpoints
GET /buildingswith?include=roomsor?include=rooms.lampsGET /buildings/{id}with?include=rooms.lampsGET /buildings/{id}/roomswith?include=lampsGET /rooms/{id}with?include=lamps,building
Functional Requirement
Must minimize database queries regardless of the number of entities returned.
Implementation Hints
- Write SQL queries with JOINs in sqlc
- Create separate query variants for different include combinations
- Or use dynamic query building with proper JOIN clauses
- Map flattened results back to nested structs
Acceptance Criteria
-
?include=roomsreturns buildings with nested rooms -
?include=rooms.lampsreturns buildings with rooms and lamps - Query count does not increase with number of buildings (verify with SQL logging)
Parent Issue
Relates to #289
Reactions are currently unavailable