jqutil

package
v1.26.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirModuleLoader

func DirModuleLoader(basePath string) gojq.ModuleLoader

func Eval

func Eval(ctx context.Context, opts EvalOptions) (string, error)

func Extract

func Extract(ctx context.Context, opts EvalOptions) (map[string]any, error)

func ForEach

func ForEach(ctx context.Context, opts EvalOptions, action func(any) error) error

func InferType

func InferType(value string) any

InferType attempts to infer and convert a string value to its most appropriate Go type. It supports primitive types (bool, int32, int64, float64, string), as well as structured types commonly found in Kubernetes configurations (map[string]any and []any). The function first tries to parse the input as JSON. If that fails, it falls back to custom parsing logic for booleans, nil/null, integers, and floats. If no conversion is possible, the original string is returned.

func MaybeQuery

func MaybeQuery(s string) (string, bool)

Types

type EvalOptions

type EvalOptions struct {
	Query        string
	Unquote      bool
	Data         any
	ModuleLoader gojq.ModuleLoader
}

Jump to

Keyboard shortcuts

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