Documentation ¶
Overview ¶
Package filter implements https://google.aip.dev/160. This is used to filter a collection using a "structured syntax accessible to a non-technical audience."
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Evaluator ¶
Evaluator takes an Expr and an arbitrary Go type. It returns a function that takes an argument of that Go type and reports whether it matches the expression. The functions argument contains functions the filter expression may call. Evaluator also returns a list of warning messages about the expression.
Types ¶
type Expr ¶
type Expr interface { String() string // returns a multi-line string representation // contains filtered or unexported methods }
Expr is the parsed AST of a filter expression.
type Functions ¶
Functions is a set of functions that are permitted when filtering. Each value in the map must be a function. Each function must take at least one argument, which is the type T in Evaluator[T]. The function may take other arguments, which will come from the filter expression. The function should return one or two results; the first result is the type that the function returns, and the optional second result is type error.