listfilter

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, or equality on an Exact field, which refuses AIP-160's :* key-exists test), and a many-valued field matches when any of its values does (!= when none does). A prefix field (settings.userLabels.) takes every longer field name, the rest of the name a key; a resource without the key reads as empty. 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
	// Exact makes : compare a string field for equality, like =.
	Exact 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
	// Key, when set instead of Get, makes the field a prefix field: its
	// name in the map is a prefix (settings.userLabels.) that every
	// longer field name matches, and Key gets the rest of that name (a
	// label key). A field name in the map is looked up before a prefix
	// field.
	Key func(v T, key string) string
}

Field is a filterable field of T.

Jump to

Keyboard shortcuts

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