jsonutil

package
v0.0.0-...-e521cbd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: BSD-3-Clause Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtPathIn

func AtPathIn(obj interface{}, path []string) (interface{}, error)

func ExtendPrefix

func ExtendPrefix(prefix []string, segment string) []string

func ExtraneousAnyPaths

func ExtraneousAnyPaths(prefix []string, before interface{}, after interface{}) [][]string

func ExtraneousFieldPaths

func ExtraneousFieldPaths(data map[string]interface{}, parsed interface{}) ([][]string, error)

ExtraneousFieldPaths finds paths in "data" that aren't in "parsed" by serializing

"parsed" to a dictionary and recursively comparing its fields to those of "data".

func ExtraneousMapPaths

func ExtraneousMapPaths(prefix []string, before map[string]interface{}, after interface{}) [][]string

func ExtraneousSlicePaths

func ExtraneousSlicePaths(prefix []string, before []interface{}, after interface{}) [][]string

func FieldValIsEmpty

func FieldValIsEmpty(fieldVal interface{}) bool

func GetOnlyMapEntry

func GetOnlyMapEntry(obj map[string]interface{}) (string, interface{}, error)

GetOnlyMapEntry get the only entry from a map. Error if the map doesn't contain exactly one entry.

func GetStringEntry

func GetStringEntry(obj map[string]interface{}, key string) (string, error)

func MarshalMap

func MarshalMap(source interface{}) (map[string]interface{}, error)

func UnmarshalMap

func UnmarshalMap(data map[string]interface{}, target interface{}) error

Types

type ExtraneousFieldsError

type ExtraneousFieldsError struct {
	Paths [][]string
}

func (*ExtraneousFieldsError) Error

func (e *ExtraneousFieldsError) Error() string

Jump to

Keyboard shortcuts

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