Documentation ¶
Overview ¶
Package stringmap contains convenience functions for maps with string keys
Index ¶
- func GetValueInMap(searchedMap map[string]interface{}, path ...string) (interface{}, error)
- func HaveValueInMap(searchedMap map[string]interface{}, path ...string) bool
- func MergeIntoMap(subject StringMap, otherMap StringMap) error
- func RemoveValueInMap(mapToChange map[string]interface{}, path ...string) error
- func SetValueInMap(mapToChange map[string]interface{}, value interface{}, path ...string) error
- type StringMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValueInMap ¶
GetValueInMap returns the value of a nested StringMap at the specified path
func HaveValueInMap ¶ added in v0.32.32
HaveValueInMap indicates whether the nested StringMap has a value at the specified path
func MergeIntoMap ¶
MergeIntoMap deep merges values from one StringMap into another
For each key path at which subject does not have a value, this will set the value from otherMap even if subject has a value at a prefix of the key path. Existing values - including nil - at matching complete paths will not be overwritten.
func RemoveValueInMap ¶ added in v0.32.12
RemoveValueInMap removes the value of a nested StringMap at the specified path
Trying to remove a non-existent value returns an error.
func SetValueInMap ¶
SetValueInMap fixes the value of a nested StringMap at the specified path
Additional levels of nesting will be created if necessary.