maps

package
v3.0.67-0...-1b42412 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineMapTrees

func CombineMapTrees(destination map[string]interface{}, input map[string]interface{})

CombineMapTrees recursively copies all the values from the input map into the destination map preserving any missing entries in the destination

func GetMapValueAsIntViaPath

func GetMapValueAsIntViaPath(m map[string]interface{}, path string) int

GetMapValueAsIntViaPath returns the int value at the given path mean `m["foo"]["bar"]["whatnot"]`

func GetMapValueAsMapViaPath

func GetMapValueAsMapViaPath(m map[string]interface{}, path string) map[string]interface{}

GetMapValueAsMapViaPath returns the map value at the given path mean `m["foo"]["bar"]["whatnot"]`

func GetMapValueAsStringViaPath

func GetMapValueAsStringViaPath(m map[string]interface{}, path string) string

GetMapValueAsStringViaPath returns the string value at the given path mean `m["foo"]["bar"]["whatnot"]`

func GetMapValueViaPath

func GetMapValueViaPath(m map[string]interface{}, path string) interface{}

GetMapValueViaPath returns the value at the given path mean `m["foo"]["bar"]["whatnot"]`

func KeyValuesToMap

func KeyValuesToMap(values []string) map[string]string

KeyValuesToMap converts the set of values of the form "foo=abc" into a map

func MapKeys

func MapKeys(m map[string]string) []string

MapKeys returns the keys of a given map

func MapToKeyValues

func MapToKeyValues(values map[string]string) []string

MapToKeyValues converts the the map into a sorted array of key/value pairs

func MapToString

func MapToString(m map[string]string) string

MapToString converts the map to a string

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

MergeMaps merges all the maps together with the entries in the last map overwriting any earlier values

so if you want to add some annotations to a resource you can do resource.Annotations = kube.MergeMaps(resource.Annotations, myAnnotations)

func SetMapValueViaPath

func SetMapValueViaPath(m map[string]interface{}, path string, value interface{})

SetMapValueViaPath sets the map key using the given path which supports the form `foo.bar.whatnot` to mean `m["foo"]["bar"]["whatnot"]` lazily creating maps as the path is navigated

func StringMapHasValue

func StringMapHasValue(m map[string]string, value string) bool

StringMapHasValue returns true if the given map contains the given value

func ToObjectMap

func ToObjectMap(object interface{}) (map[string]interface{}, error)

ToObjectMap converts the given object into a map of strings/maps using YAML marshalling

Types

This section is empty.

Jump to

Keyboard shortcuts

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