Documentation
¶
Overview ¶
Package filter provides a generic specification pattern implementation for filtering resources.
It defines interfaces for Filters and Specifications that can be used to build complex query criteria in a type-safe manner. It includes common validators and logical operators.
Index ¶
- func AnyValid(validators ...func(FieldFilter[any]) error) func(FieldFilter[any]) error
- func NewFieldFilter[T any](op Operator, name string, val T) *fieldFilter[T]
- func ValidateArrayOrSingleField[T any](f FieldFilter[any]) error
- func ValidateIntegerString(f FieldFilter[any]) error
- func ValidateNil(f FieldFilter[any]) error
- func ValidateNotZero(f FieldFilter[any]) error
- func ValidateTyped[T any](f FieldFilter[any]) error
- func ValidateUUID(f FieldFilter[any]) error
- func ValidateValOneOf[T comparable](allowed ...T) func(FieldFilter[any]) error
- type FieldFilter
- type Operator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyValid ¶
func AnyValid(validators ...func(FieldFilter[any]) error) func(FieldFilter[any]) error
AnyValid returns a validator that passes if at least one of the validators passes
func NewFieldFilter ¶
func ValidateArrayOrSingleField ¶
func ValidateArrayOrSingleField[T any](f FieldFilter[any]) error
func ValidateIntegerString ¶
func ValidateIntegerString(f FieldFilter[any]) error
func ValidateNil ¶
func ValidateNil(f FieldFilter[any]) error
func ValidateNotZero ¶
func ValidateNotZero(f FieldFilter[any]) error
ValidateNotZero validates that a field filter's value is not a zero value
func ValidateTyped ¶
func ValidateTyped[T any](f FieldFilter[any]) error
ValidateTyped validates that a field filter's value is of the specified type T
func ValidateUUID ¶
func ValidateUUID(f FieldFilter[any]) error
func ValidateValOneOf ¶
func ValidateValOneOf[T comparable](allowed ...T) func(FieldFilter[any]) error
ValidateValOneOf returns a validator that checks if the value is one of the allowed values
Types ¶
type FieldFilter ¶
Click to show internal directories.
Click to hide internal directories.