Documentation
¶
Overview ¶
Package filter 定义可序列化的过滤规则模型及其组合方式。
Package filter GENERATED BY gengo:enum DON'T EDIT THIS FILE
Package filter GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
Index ¶
- Variables
- func First[A Arg, O any](args iter.Seq[A], where func(a Arg) (O, bool)) (O, bool)
- func MapFilter[T comparable, A Arg, O any](args iter.Seq[A], where func(a *Filter[T]) (O, bool)) iter.Seq[O]
- func MapWhere[A Arg, O any](args iter.Seq[A], where func(a Arg) (O, bool)) iter.Seq[O]
- type Arg
- type Composed
- type ErrInvalidFilter
- type ErrInvalidFilterOp
- type ErrUnsupportedQLField
- type Filter
- func And[T comparable](filters ...TypedRule[T]) *Filter[T]
- func Contains[T comparable](v T) *Filter[T]
- func Eq[T comparable](v T) *Filter[T]
- func Gt[T comparable](v T) *Filter[T]
- func Gte[T comparable](v T) *Filter[T]
- func In[T comparable](values ...T) *Filter[T]
- func InSeq[T comparable](values iter.Seq[T]) *Filter[T]
- func Intersection[T comparable](filters ...TypedRule[T]) *Filter[T]
- func Lt[T comparable](v T) *Filter[T]
- func Lte[T comparable](v T) *Filter[T]
- func Neq[T comparable](v T) *Filter[T]
- func Notin[T comparable](values ...T) *Filter[T]
- func NotinSeq[T comparable](values iter.Seq[T]) *Filter[T]
- func Or[T comparable](filters ...TypedRule[T]) *Filter[T]
- func Prefix[T comparable](v T) *Filter[T]
- func Suffix[T comparable](v T) *Filter[T]
- func (v Filter[T]) Args() iter.Seq[Arg]
- func (f Filter[T]) IsZero() bool
- func (f Filter[T]) MarshalDirective() ([]byte, error)
- func (f Filter[T]) MarshalText() ([]byte, error)
- func (v Filter[T]) New() *T
- func (Filter[T]) OneOf() []any
- func (f Filter[T]) Op() Op
- func (f Filter[T]) String() string
- func (f *Filter[T]) UnmarshalDirective(dec *directive.Decoder) error
- func (f *Filter[T]) UnmarshalText(data []byte) error
- func (f Filter[T]) WhereOf(name string) Rule
- type Op
- func (Op) EnumValues() []any
- func (v Op) IsZero() bool
- func (v Op) Label() string
- func (v Op) MarshalText() ([]byte, error)
- func (*Op) RuntimeDoc(names ...string) ([]string, bool)
- func (v *Op) Scan(src any) error
- func (v Op) String() string
- func (v *Op) UnmarshalText(data []byte) error
- func (v Op) Value() (driver.Value, error)
- type P
- type Rule
- type RuleExpr
- type TypedRule
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidOp = errors.New("invalid Op")
Functions ¶
Types ¶
type Composed ¶
type Composed struct {
Filters []any
// contains filtered or unexported fields
}
Composed 表示组合后的过滤条件集合。
func (Composed) MarshalText ¶
func (*Composed) UnmarshalText ¶
type ErrInvalidFilter ¶
type ErrInvalidFilter struct {
Filter string
// contains filtered or unexported fields
}
ErrInvalidFilter 表示过滤表达式非法。
func (*ErrInvalidFilter) Error ¶
func (e *ErrInvalidFilter) Error() string
func (*ErrInvalidFilter) RuntimeDoc ¶
func (v *ErrInvalidFilter) RuntimeDoc(names ...string) ([]string, bool)
func (ErrInvalidFilter) StatusCode ¶
func (ErrInvalidFilter) StatusCode() int
type ErrInvalidFilterOp ¶
type ErrInvalidFilterOp struct {
Op string
// contains filtered or unexported fields
}
ErrInvalidFilterOp 表示过滤操作符非法。
func (*ErrInvalidFilterOp) Error ¶
func (e *ErrInvalidFilterOp) Error() string
func (*ErrInvalidFilterOp) RuntimeDoc ¶
func (v *ErrInvalidFilterOp) RuntimeDoc(names ...string) ([]string, bool)
func (ErrInvalidFilterOp) StatusCode ¶
func (ErrInvalidFilterOp) StatusCode() int
type ErrUnsupportedQLField ¶
type ErrUnsupportedQLField struct {
FieldName string
// contains filtered or unexported fields
}
ErrUnsupportedQLField 表示查询字段不受支持。
func (*ErrUnsupportedQLField) Error ¶
func (e *ErrUnsupportedQLField) Error() string
func (*ErrUnsupportedQLField) RuntimeDoc ¶
func (v *ErrUnsupportedQLField) RuntimeDoc(names ...string) ([]string, bool)
func (ErrUnsupportedQLField) StatusCode ¶
func (ErrUnsupportedQLField) StatusCode() int
type Filter ¶
type Filter[T comparable] struct { // contains filtered or unexported fields }
Filter 表示一条具体过滤规则。
func Intersection ¶
func Intersection[T comparable](filters ...TypedRule[T]) *Filter[T]
Intersection 构造多个条件的交集组合。
func NotinSeq ¶
func NotinSeq[T comparable](values iter.Seq[T]) *Filter[T]
NotinSeq 构造值不属于给定序列的过滤条件。
func (Filter[T]) MarshalDirective ¶
func (Filter[T]) MarshalText ¶
func (*Filter[T]) UnmarshalDirective ¶
func (*Filter[T]) UnmarshalText ¶
type Op ¶
type Op uint8
+gengo:enum Op 表示过滤条件的操作符类型。
func ParseOpFromString ¶
func ParseOpLabelString ¶
func (Op) EnumValues ¶
func (Op) MarshalText ¶
func (*Op) UnmarshalText ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.