jsonexpr

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package jsonexpr provides JSON extractor expression parser.

Index

Constants

View Source
const (
	Index = iota + 1
	Key
)

Variables

This section is empty.

Functions

func Extract

func Extract(
	d *jx.Decoder,
	paths map[logql.Label]Path,
	extract func(logql.Label, string),
) error

Extract extracts values from given paths using extract callback.

Types

type Path

type Path []Selector

Path is a list of selectors.

func Parse

func Parse(input string) (sel Path, _ error)

Parse parses selector expression.

func (Path) Equal

func (p Path) Equal(other Path) bool

Equal compares p to other.

type Selector

type Selector struct {
	Type  SelectorType
	Index int
	Key   string
}

Selector is a JSON field/element selector.

func IndexSel

func IndexSel(i int) Selector

IndexSel creates new index Selector.

func KeySel

func KeySel(k string) Selector

KeySel creates new key Selector.

type SelectorType

type SelectorType int

SelectorType is a Selector type.

Jump to

Keyboard shortcuts

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