maputil

package
v0.0.0-...-b178995 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("Key not found")

Functions

func FlattenList

func FlattenList(l []interface{}, parent, delimiter string) map[string]interface{}

FlattenList takes a `[]interface{}` and flatten/explode each items a map key. e.g.: ["s1", "s2"] => {"0": "s1", "1": "s2"}

func FlattenMap

func FlattenMap(m map[string]interface{}, parent, delimiter string) map[string]interface{}

FlattenMap takes a `map[string]interface{}` and flatten/explode it e.g.: {"k1": {"k2": 1}} => {"k1.k2": 1}

func GetPath

func GetPath(doc map[string]interface{}, path string) (interface{}, error)

GetPath returns the map value for the given "dot notation" path, or returns `ErrKeyNotFound`

Types

This section is empty.

Jump to

Keyboard shortcuts

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