syntax

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package jsonpath is for retrieving a part of JSON according to the JSONPath query syntax.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableMemoize

func DisableMemoize[U Uint]() func(*pegJSONPathParser[U]) error

func Parse

func Parse(jsonPath string, config ...Config) (f func(src any) ([]any, error), err error)

Parse returns the parser function using the given JSONPath.

func Pretty

func Pretty[U Uint](pretty bool) func(*pegJSONPathParser[U]) error

func ResetNodeSliceSyncPool

func ResetNodeSliceSyncPool()

func Retrieve

func Retrieve(jsonPath string, src any, config ...Config) ([]any, error)

Retrieve returns the retrieved JSON using the given JSONPath.

func Size

func Size[U Uint](size int) func(*pegJSONPathParser[U]) error

Types

type Accessor

type Accessor struct {
	Get func() any
	Set func(any)
}

Accessor represents the accessor to the result nodes of JSONPath.

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config represents the configuration parameters.

func (*Config) SetAccessorMode

func (c *Config) SetAccessorMode()

SetAccessorMode sets a collection of accessors to the result.

func (*Config) SetAggregateFunction

func (c *Config) SetAggregateFunction(id string, function func([]any) (any, error))

SetAggregateFunction sets the custom function.

func (*Config) SetFilterFunction

func (c *Config) SetFilterFunction(id string, function func(any) (any, error))

SetFilterFunction sets the custom function.

type Uint

type Uint interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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