api

command
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 11 Imported by: 0

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 .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL