query

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NestedBool

func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool, error)

NestedBool returns the bool value of a nested field. Returns false if value is not found and an error if not a bool.

func NestedFieldCopy

func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error)

NestedFieldCopy returns a deep copy of the value of a nested field. Returns false if the value is missing. No error is returned for a nil field.

Note: fields passed to this function are treated as keys within the passed object; no array/slice syntax is supported.

func NestedFieldNoCopy

func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error)

NestedFieldNoCopy returns a reference to a nested field. Returns false if value is not found and an error if unable to traverse obj.

Note: fields passed to this function are treated as keys within the passed object; no array/slice syntax is supported.

func NestedFloat64

func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool, error)

NestedFloat64 returns the float64 value of a nested field. Returns false if value is not found and an error if not a float64.

func NestedInt64

func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool, error)

NestedInt64 returns the int64 value of a nested field. Returns false if value is not found and an error if not an int64.

func NestedMap

func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error)

NestedMap returns a deep copy of map[string]interface{} value of a nested field. Returns false if value is not found and an error if not a map[string]interface{}.

func NestedSlice

func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool, error)

NestedSlice returns a deep copy of []interface{} value of a nested field. Returns false if value is not found and an error if not a []interface{}.

func NestedString

func NestedString(obj map[string]interface{}, fields ...string) (string, bool, error)

NestedString returns the string value of a nested field. Returns false if value is not found and an error if not a string.

func NestedStringMap

func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool, error)

NestedStringMap returns a copy of map[string]string value of a nested field. Returns false if value is not found and an error if not a map[string]interface{} or contains non-string values in the map.

func NestedStringSlice

func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool, error)

NestedStringSlice returns a copy of []string value of a nested field. Returns false if value is not found and an error if not a []interface{} or contains non-string items in the slice.

func QueryFieldNoCopy

func QueryFieldNoCopy(d map[string]interface{}, expr string) (interface{}, bool, error)

func QueryJSONPathCopy

func QueryJSONPathCopy(obj map[string]interface{}, expr string) (interface{}, bool, error)

func QueryJSONPathNoCopy

func QueryJSONPathNoCopy(d interface{}, expr string) (interface{}, bool, error)

func QuerySlice

func QuerySlice(d map[string]interface{}, expr string) ([]interface{}, bool, error)

func RemoveNestedField

func RemoveNestedField(obj map[string]interface{}, fields ...string)

RemoveNestedField removes the nested field from the obj.

func SetNestedField

func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) error

SetNestedField sets the value of a nested field to a deep copy of the value provided. Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.

func SetNestedMap

func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) error

SetNestedMap sets the map[string]interface{} value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.

func SetNestedSlice

func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) error

SetNestedSlice sets the slice value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.

func SetNestedStringMap

func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) error

SetNestedStringMap sets the map[string]string value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.

func SetNestedStringSlice

func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) error

SetNestedStringSlice sets the string slice value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.

Types

This section is empty.

Jump to

Keyboard shortcuts

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