Documentation
¶
Overview ¶
Package listfilter evaluates the filter of a list call, as gcloud and the client libraries send it: field OP value terms (value bare or double-quoted) combined with AND, OR, NOT and parentheses, adjacent terms ANDed. String fields take =, != and : (contains), and a many-valued field matches when any of its values does (!= when none does); time fields take = != < <= > >= against RFC 3339 timestamps, and a resource without the time matches only !=. An unknown field, an operator a field does not take or a syntax error is the Service's INVALID_ARGUMENT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
func Compile[T any](filter string, fields map[string]Field[T], invalid func(format string, args ...any) error) (func(T) bool, error)
Compile parses filter into a predicate over T; an empty filter matches everything. invalid builds the Service's INVALID_ARGUMENT error for a filter it refuses.
Types ¶
type Field ¶
type Field[T any] struct { // Time compares the field as an RFC 3339 timestamp. Time bool // Get returns the field's value. Get func(T) string // Values, when set instead of Get, returns a many-valued field's // values (a Build's tags). Values func(T) []string }
Field is a filterable field of T.