Documentation
¶
Overview ¶
Example: api
Demonstrates dynamic query composition from HTTP request parameters — the drel equivalent of EF Core's IQueryable pattern. The immutable builder pattern makes conditional WHERE chaining natural: each .Where() call returns a new QueryBuilder without mutating the original.
The GET /products endpoint builds a query incrementally from query params (minPrice, maxPrice, category, inStock, sort, limit), showing how server-side filtering composes cleanly with drel's type-safe column references.
Usage:
cd examples/api go run ../../cmd/drel generate # generates products/product_drel.go + db/drel_gen.go export DATABASE_URL="postgres://localhost:5432/drelexample?sslmode=disable" go run .
Click to show internal directories.
Click to hide internal directories.