Documentation
¶
Overview ¶
Package maps contains methods to operate maps of all kinds
Package maps contains methods to operate maps of all kinds
Index ¶
- func AsBool(data map[string]string, key string) (*bool, error)
- func AsObject(data map[string]string, key string, object interface{}) error
- func IsSameStringMap(first map[string]string, second map[string]string) bool
- func MergeMap(left, right map[string]string) map[string]string
- func MergeMapIfNotExists(left, right map[string]string) map[string]string
- func MergeMapMap(left, right map[string]map[string]string) map[string]map[string]string
- func MergeMapSlice(left, right map[string][]string) map[string][]string
- func SelectAndMutateMap(maps map[string]string, match MatchFunc, mutate MutateFunc) map[string]string
- type KeyValue
- type MatchFunc
- type MutateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsBool ¶ added in v0.8.0
AsBool will parse value in data["key"] to bool if the key not exist, it will return nil if the value is not a valid bool string, it will return error
func AsObject ¶ added in v0.8.0
AsObject will parse value in data["key"] to object it expects the value should be yaml content
func IsSameStringMap ¶ added in v0.8.0
IsSameStringMap return true if provided two map[string]string are same or false if they are different
func MergeMapIfNotExists ¶ added in v0.8.0
MergeMapIfNotExists merges the right map into left map if right key is not exists in left
func MergeMapMap ¶
MergeMapMap merges the right map into left map overwritting any matching keys
func MergeMapSlice ¶
MergeMapSlice merges the right map into left map overwritting any matching keys
func SelectAndMutateMap ¶ added in v0.11.0
func SelectAndMutateMap(maps map[string]string, match MatchFunc, mutate MutateFunc) map[string]string
SelectAndMutateMap select elements from a map based on a match function and mutate it's key and value
Types ¶
type KeyValue ¶
KeyValue a key/value pair just like a map[string]string
func SortedKeyValue ¶
SortedKeyValue returns a list of key values sorted by key
type MutateFunc ¶ added in v0.11.0
MutateFunc return mutated key and value