filter

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package filter applies filters (`count`, `jsonpath`, `toInt`, …) to the value of a query.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(items []*syntax.FilterItem, v value.Value, env *template.Env, inAssert bool) (value.Value, error)

Apply applies filters in order to v. A nil result means the last filter produced no value; a filter that receives no value fails. inAssert marks errors raised while evaluating an assert.

func Eval

func Eval(f *syntax.Filter, v value.Value, env *template.Env, inAssert bool) (value.Value, error)

Eval applies one filter to v (non-nil).

func EvalJSONPath

func EvalJSONPath(doc value.Value, expr *syntax.Template, env *template.Env) (value.Value, error)

EvalJSONPath evaluates a JSONPath template on a document. No match gives nil, one match its value, several matches a list.

func EvalXPath

func EvalXPath(doc *xpath.Document, expr *syntax.Template, env *template.Env) (value.Value, error)

EvalXPath evaluates an XPath template on a document.

func FirstGroup

func FirstGroup(re *regexp.Regexp, s string) (string, bool)

FirstGroup returns the text of the first capture group of the leftmost match; ok is false when nothing matches or the group did not participate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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