Documentation
¶
Index ¶
- func WithIn(values ...string) optionValidateFunc
- func WithMax(max json.Number) optionValidateFunc
- func WithMin(min json.Number) optionValidateFunc
- func WithNotAllowed() 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 OptionQuery
- type OptionValidate
- type OptionValidateSet
- type Query
- type Token
- type Validator
- type WalkType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithNotAllowed ¶ added in v0.1.2
func WithNotAllowed() optionValidateFunc
func WithNotEmpty ¶
func WithNotEmpty() optionValidateFunc
WithNotEmpty to validate the value is not empty.
- only usable for 'WithValue'
func WithRequired ¶
func WithRequired() optionValidateFunc
WithRequired to validate the value is required.
- only usable for 'WithValue'
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 OptionQuery ¶ added in v0.1.2
type OptionQuery func(*optionQuery)
func WithDefaultLimit ¶ added in v0.1.2
func WithDefaultLimit(limit uint64) OptionQuery
WithDefaultLimit sets the default limit value.
func WithDefaultOffset ¶ added in v0.1.2
func WithDefaultOffset(offset uint64) OptionQuery
WithDefaultOffset sets the default offset value.
func WithExpressionCmp ¶ added in v0.1.2
func WithExpressionCmp(key string, value ExpressionCmp) OptionQuery
type OptionValidate ¶
type OptionValidate func(string, ...optionValidateFunc)
type OptionValidateSet ¶
func WithField ¶
func WithField(opts ...optionValidateFunc) OptionValidateSet
func WithValue ¶
func WithValue(key string, opts ...optionValidateFunc) OptionValidateSet
func WithValues ¶ added in v0.1.2
func WithValues(opts ...optionValidateFunc) OptionValidateSet
type Query ¶
type Query struct {
Values map[string][]ExpressionCmp
Select []string
Where []Expression
Order []ExpressionOrder
Offset *uint64
Limit *uint64
}
func Parse ¶
func Parse(query string, opts ...OptionQuery) (*Query, error)
Parse parses a query string into a Query struct.
func ParseWithValidator ¶ added in v0.1.2
func ParseWithValidator(query string, validator *Validator, opts ...OptionQuery) (*Query, error)
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.