filter

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilterTypeUnknow       = errors.New("unknow filter type")
	ErrPropertyNameInvalid    = errors.New("invalid property name")
	ErrPropertyOperatorUnknow = errors.New("unknow property operator")
)

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Type   string      `json:"type,omitempty"`
	Params interface{} `json:"params,omitempty"`
}

Filter holds data for filtering results in a query.

func (*Filter) IsValid

func (f *Filter) IsValid() error

IsValid check if is valid.

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(data []byte) error

type FilterList

type FilterList []*Filter

FilterList is a slice of Filter.

func (*FilterList) IsValid

func (f *FilterList) IsValid() error

IsValid check if filter list is valid.

func (*FilterList) UnmarshalParam

func (f *FilterList) UnmarshalParam(value string) error

UnmarshalParam converts a base64 filter string to a FilterList.

type FilterTypeOperator

type FilterTypeOperator struct {
	// Conditional operator name
	//
	// and: AND conditional operator
	// or: OR conditional operator
	Name string `json:"name"`
}

FilterTypeOperator holds data to apply a conditional operator in a filter.

type FilterTypeProperty

type FilterTypeProperty struct {
	// Property name
	Name string `json:"name"`
	// Comparison operator
	//
	// contains: check if property contains the value
	// eq: check if the property is equal to value
	// bool: check if the property is true or false based on value
	// gt: check if the property is greater than value
	// lt: check if the property is less than value
	Operator string `json:"operator"`
	// Value to compare
	Value interface{} `json:"value"`
}

FilterTypeProperty holds data to filter a property based on value and comparison operator.

Jump to

Keyboard shortcuts

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