36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package domain
|
|
|
|
// Record is one row as the API exposes it: the frontend's exact field names
|
|
// mapped to JSON-ready values.
|
|
//
|
|
// A map rather than a struct per resource. The frontend treats every record as
|
|
// an opaque bag of fields it round-trips unchanged — `store.js` stores whatever
|
|
// it was handed and returns a clone — and fourteen structs totalling ~350
|
|
// fields would add a transcription risk without adding a guarantee. Typing
|
|
// lives in the Column descriptors instead, where validation and SQL both read
|
|
// it from one place.
|
|
type Record map[string]any
|
|
|
|
// ListParams is a parsed, validated collection query.
|
|
type ListParams struct {
|
|
Sort string // column name, without the leading '-'
|
|
Desc bool
|
|
Limit int
|
|
Offset int
|
|
Filters []Filter
|
|
}
|
|
|
|
// Filter is one equality or membership test. See api-contract.md §6.
|
|
type Filter struct {
|
|
Column *Column
|
|
Values []string // len > 1 means IN
|
|
}
|
|
|
|
// Page is a collection result plus the metadata the envelope reports.
|
|
type Page struct {
|
|
Records []Record
|
|
Total int
|
|
Limit int
|
|
Offset int
|
|
}
|