Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSearchSchema ¶
func NewSearchSchema[T any]() *v.ObjectSchema[SearchQuery[T]]
NewSearchSchema builds a validator for SearchQuery[T]. Keys in where/fields/sort are validated against T's json field names. Operator keys inside where[field] are validated against the allowed set.
Types ¶
type SearchFields ¶
type SearchQuery ¶
type SearchQuery[T any] struct { Text *string `json:"text"` Offset *int64 `json:"offset"` Limit *int64 `json:"limit"` Where map[string]any `json:"where"` Fields *SearchFields `json:"fields"` Sort map[string]int8 `json:"sort"` }
func ParseSearch ¶
func ParseSearch[T any](q string) (SearchQuery[T], error)
ParseSearch validates and parses a JSON search query string. Designed for GET ?q=<json> pattern.
Click to show internal directories.
Click to hide internal directories.