Documentation
¶
Index ¶
- func WithIn(values ...string) optionValidateFunc
- func WithMax(max json.Number) optionValidateFunc
- func WithMin(min json.Number) optionValidateFunc
- func WithNotEmpty() optionValidateFunc
- func WithNotIn(values ...string) optionValidateFunc
- func WithRequired() optionValidateFunc
- type Expression
- type ExpressionCmp
- type ExpressionLogic
- type ExpressionOrder
- type OperatorCmpType
- type OperatorLogicType
- type OptionValidate
- type OptionValidateSet
- type Query
- type Token
- type Validator
- type WalkType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithNotEmpty ¶
func WithNotEmpty() optionValidateFunc
func WithRequired ¶
func WithRequired() optionValidateFunc
Types ¶
type Expression ¶
type Expression interface {
Expression() Expression
}
type ExpressionCmp ¶
type ExpressionCmp struct {
Operator OperatorCmpType
Field string
Value any
}
func (ExpressionCmp) Expression ¶
func (e ExpressionCmp) Expression() Expression
type ExpressionLogic ¶
type ExpressionLogic struct {
Operator OperatorLogicType
List []Expression
}
func (ExpressionLogic) Expression ¶
func (e ExpressionLogic) Expression() Expression
type ExpressionOrder ¶
type OperatorCmpType ¶
type OperatorCmpType string
const ( // OperatorEq is the equality operator. OperatorEq OperatorCmpType = "eq" // OperatorNe is the not equal operator. OperatorNe OperatorCmpType = "ne" // OperatorGt is the greater than operator. OperatorGt OperatorCmpType = "gt" // OperatorLt is the less than operator. OperatorLt OperatorCmpType = "lt" // OperatorGte is the greater than or equal operator. OperatorGte OperatorCmpType = "gte" // OperatorLte is the less than or equal operator. OperatorLte OperatorCmpType = "lte" // OperatorLike is the like operator. OperatorLike OperatorCmpType = "like" // OperatorILike is the case insensitive like operator. OperatorILike OperatorCmpType = "ilike" // OperatorNLike is the not like operator. OperatorNLike OperatorCmpType = "nlike" // OperatorNILike is the case insensitive not like operator. OperatorNILike OperatorCmpType = "nilike" // OperatorIn is the in operator. OperatorIn OperatorCmpType = "in" // OperatorNIn is the not in operator. OperatorNIn OperatorCmpType = "nin" // OperatorIs is the is null operator. OperatorIs OperatorCmpType = "is" // OperatorIsNot is the is not null operator. OperatorIsNot OperatorCmpType = "not" )
type OperatorLogicType ¶
type OperatorLogicType string
const ( // OperatorAnd is the AND operator. OperatorAnd OperatorLogicType = "and" // OperatorOr is the OR operator. OperatorOr OperatorLogicType = "or" )
type OptionValidate ¶
type OptionValidate func(string, ...optionValidateFunc)
type OptionValidateSet ¶
func WithField ¶
func WithField(key string, opts ...optionValidateFunc) OptionValidateSet
func WithValue ¶
func WithValue(key string, opts ...optionValidateFunc) OptionValidateSet
type Query ¶
type Query struct {
Values map[string][]ExpressionCmp
Select []any
Where []Expression
Order []ExpressionOrder
Offset *uint64
Limit *uint64
}
type Token ¶
type Token struct {
Expression Expression
Type WalkType
}
type Validator ¶ added in v0.1.1
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator(opts ...OptionValidateSet) (*Validator, error)
Click to show internal directories.
Click to hide internal directories.