selectcmd

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Select

func Select(condition Condition) gloo.Command[[]byte, []byte]

Select returns a command that keeps each JSON value for which condition reports true, emitting one compact value per line. Values that fail the condition are dropped.

Shell analogue: jq 'select(...)'

Types

type Condition

type Condition func(value jsoncmd.Value) bool

Condition reports whether a decoded JSON value should be selected.

func And

func And(conditions ...Condition) Condition

And combines multiple conditions with logical AND

func FieldEquals

func FieldEquals(field Field, expected any) Condition

FieldEquals returns a condition that checks if a field equals a specific value

func FieldMatches

func FieldMatches(field Field, predicate func(any) bool) Condition

FieldMatches returns a condition that checks if a field matches a predicate

func HasField

func HasField(field Field) Condition

HasField returns a condition that checks if an object has a specific field

func Not

func Not(condition Condition) Condition

Not negates a condition

func Or

func Or(conditions ...Condition) Condition

Or combines multiple conditions with logical OR

type Field

type Field string

Field names one key of a JSON object.

Jump to

Keyboard shortcuts

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