jsonQuery

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JQ

type JQ struct {
	Data any
}

JQ (JSON Query) struct

func NewFileQuery

func NewFileQuery(jsonFile string) (*JQ, error)

NewFileQuery - Create a new &JQ from a JSON file.

func NewQuery

func NewQuery(jsonObject any) *JQ

NewQuery - Create a &JQ from any parsed by json.Unmarshal

func NewStringQuery

func NewStringQuery(jsonString string) (*JQ, error)

NewStringQuery - Create a new &JQ from a raw JSON string.

func (*JQ) Query

func (jq *JQ) Query(exp string) (any, error)

Query - queries against the JSON with the expression passed in. The exp is separated by dots (".")

func (*JQ) QueryToArray

func (jq *JQ) QueryToArray(exp string) ([]any, error)

QueryToArray - Queries and converts the result to a slice of any ([]any)

func (*JQ) QueryToBool

func (jq *JQ) QueryToBool(exp string) (bool, error)

QueryToBool - Queries and converts the result to a boolean

func (*JQ) QueryToFloat64

func (jq *JQ) QueryToFloat64(exp string) (float64, error)

QueryToFloat64 - Queries and converts the result to a float64

func (*JQ) QueryToInt64

func (jq *JQ) QueryToInt64(exp string) (int64, error)

QueryToInt64 - Queries and converts the result to an int64

func (*JQ) QueryToMap

func (jq *JQ) QueryToMap(exp string) (map[string]any, error)

QueryToMap - Queries and converts the result to a map[string]any

func (*JQ) QueryToString

func (jq *JQ) QueryToString(exp string) (string, error)

QueryToString - Queries and converts the result to a string

Jump to

Keyboard shortcuts

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