filter

package
v0.0.0-...-9c037f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package filter GENERATED BY gengo:enum DON'T EDIT THIS FILE

Package filter GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE

Index

Constants

This section is empty.

Variables

View Source
var InvalidOp = pkgerrors.New("invalid Op")

Functions

func First

func First[A Arg, O any](args []A, where func(a Arg) (O, bool)) (O, bool)

func MapFilter

func MapFilter[T comparable, A Arg, O any](args []A, where func(a *Filter[T]) (O, bool)) []O

func MapWhere

func MapWhere[A Arg, O any](args []A, where func(a Arg) (O, bool)) []O

Types

type Arg

type Arg interface {
	encoding.TextMarshaler
}

type Composed

type Composed struct {
	Filters []any
	// contains filtered or unexported fields
}

func Compose

func Compose(filters ...any) *Composed

func (Composed) IsZero

func (c Composed) IsZero() bool

func (Composed) MarshalText

func (c Composed) MarshalText() ([]byte, error)

func (Composed) RuntimeDoc

func (v Composed) RuntimeDoc(names ...string) ([]string, bool)

func (*Composed) UnmarshalText

func (c *Composed) UnmarshalText(data []byte) error

type ErrInvalidFilter

type ErrInvalidFilter struct {
	Filter string
	// contains filtered or unexported fields
}

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
}

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
}

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
}

func And

func And[T comparable](filters ...TypedRule[T]) *Filter[T]

func Contains

func Contains[T comparable](v T) *Filter[T]

Contains str

func Eq

func Eq[T comparable](v T) *Filter[T]

Eq == v

func Gt

func Gt[T comparable](v T) *Filter[T]

Gt > v

func Gte

func Gte[T comparable](v T) *Filter[T]

Gte >= v

func In

func In[T comparable](values []T) *Filter[T]

In values

func Intersection

func Intersection[T comparable](filters ...TypedRule[T]) *Filter[T]

func Lt

func Lt[T comparable](v T) *Filter[T]

Lt < v

func Lte

func Lte[T comparable](v T) *Filter[T]

Lte <= v

func Neq

func Neq[T comparable](v T) *Filter[T]

Neq != v

func Notin

func Notin[T comparable](values []T) *Filter[T]

Notin values

func Or

func Or[T comparable](filters ...TypedRule[T]) *Filter[T]

func Prefix

func Prefix[T comparable](v T) *Filter[T]

Prefix str

func Suffix

func Suffix[T comparable](v T) *Filter[T]

Suffix str

func (Filter[T]) Args

func (v Filter[T]) Args() []Arg

func (Filter[T]) IsZero

func (f Filter[T]) IsZero() bool

func (Filter[T]) MarshalDirective

func (f Filter[T]) MarshalDirective() ([]byte, error)

func (Filter[T]) MarshalText

func (f Filter[T]) MarshalText() ([]byte, error)

func (Filter[T]) New

func (v Filter[T]) New() *T

func (Filter[T]) OneOf

func (Filter[T]) OneOf() []any

func (Filter[T]) Op

func (f Filter[T]) Op() Op

func (Filter[T]) String

func (f Filter[T]) String() string

func (*Filter[T]) UnmarshalDirective

func (f *Filter[T]) UnmarshalDirective(dec *directive.Decoder) error

func (*Filter[T]) UnmarshalText

func (f *Filter[T]) UnmarshalText(data []byte) error

func (Filter[T]) WhereOf

func (f Filter[T]) WhereOf(name string) Rule

type Op

type Op uint8

+gengo:enum

const (
	OP_UNKNOWN Op = iota

	OP__EQ
	OP__NEQ
	OP__IN
	OP__NOTIN

	OP__GTE
	OP__GT
	OP__LTE
	OP__LT

	OP__NOTCONTAINS
	OP__CONTAINS
	OP__PREFIX
	OP__SUFFIX

	OP__WHERE
	OP__AND
	OP__OR

	OP__INTERSECTION
)

func ParseOpFromString

func ParseOpFromString(s string) (Op, error)

func ParseOpLabelString

func ParseOpLabelString(label string) (Op, error)

func (Op) EnumValues

func (Op) EnumValues() []any

func (Op) Label

func (v Op) Label() string

func (Op) MarshalText

func (v Op) MarshalText() ([]byte, error)

func (Op) RuntimeDoc

func (Op) RuntimeDoc(names ...string) ([]string, bool)

func (*Op) Scan

func (v *Op) Scan(src any) error

func (Op) String

func (v Op) String() string

func (*Op) UnmarshalText

func (v *Op) UnmarshalText(data []byte) error

func (Op) Value

func (v Op) Value() (driver.Value, error)

type Rule

type Rule interface {
	Arg
	Op() Op
	Args() []Arg
	IsZero() bool

	directive.Unmarshaler
}

func OrRules

func OrRules(rules ...Rule) Rule

type RuleExpr

type RuleExpr interface {
	IsZero() bool
	WhereOf(name string) Rule
}

type TypedRule

type TypedRule[T comparable] interface {
	Rule

	New() *T
}

func Where

func Where[T comparable](name string, rules ...TypedRule[T]) TypedRule[T]

type Value

type Value[T comparable] interface {
	Arg
	Value() T
}

func Lit

func Lit[T comparable](v T) Value[T]

Directories

Path Synopsis
internal
directive
Package directive GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
Package directive GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL