Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain is a filter type that wraps other filter rules and itself. Therefore, it implements the Filter interface to allow it to be part of its ruleset. It supports also adding and popping filter rules individually.
func (*Chain) Eval ¶
func (c *Chain) Eval(filterable Filterable) (bool, error)
Eval evaluates the filter rule sets recursively based on their operator type.
func (*Chain) ExtractConditions ¶
type CompOperator ¶
type CompOperator string
CompOperator is a type used for grouping the individual comparison operators of a filter string.
const ( Equal CompOperator = "=" UnEqual CompOperator = "!=" Like CompOperator = "~" UnLike CompOperator = "!~" LessThan CompOperator = "<" LessThanEqual CompOperator = "<=" GreaterThan CompOperator = ">" GreaterThanEqual CompOperator = ">=" )
List of the supported comparison operators.
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
Condition represents a single filter condition. It provides an implementation of the Filter interface for each of the supported CompOperator. All it's fields are read-only and aren't supposed to change at runtime. For read access, you can check the available exported methods.
func (*Condition) Eval ¶
func (c *Condition) Eval(filterable Filterable) (bool, error)
Eval evaluates this Condition based on its operator. Returns true when the filter evaluates to true false otherwise.
func (*Condition) ExtractConditions ¶
type Exists ¶
type Exists struct {
// contains filtered or unexported fields
}
func (*Exists) ExtractConditions ¶
type Filter ¶
type Filter interface { Eval(filterable Filterable) (bool, error) ExtractConditions() []*Condition }
Filter is implemented by every filter chains and filter conditions.
type Filterable ¶
type Filterable interface { EvalEqual(key string, value string) (bool, error) EvalLess(key string, value string) (bool, error) EvalLike(key string, value string) (bool, error) EvalLessOrEqual(key string, value string) (bool, error) EvalExists(key string) bool }
Filterable is implemented by every filterable type.
type LogicalOp ¶
type LogicalOp string
LogicalOp is a type used for grouping the logical operators of a filter string.
const ( // None represents a filter chain type that matches when none of its ruleset matches. None LogicalOp = "!" // All represents a filter chain type that matches when all of its ruleset matches. All LogicalOp = "&" // Any represents a filter chain type that matches when at least one of its ruleset matches. Any LogicalOp = "|" )