Documentation ¶
Index ¶
- func Copy(a map[string]string) map[string]string
- func ExcludeKeyList(in map[string]string, keys []string) map[string]string
- func ExcludeKeys(in map[string]string, keys ...string) map[string]string
- func Filter(in map[string]string, filter func(string) bool) map[string]string
- func Union(maps ...map[string]string) map[string]string
- func UpdateKeys(m map[string]string, keys ...KeyPriority) map[string]string
- type KeyPriority
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExcludeKeyList ¶
ExcludeKeyList creates a copy of the provided map filtering out excluded `keys`
func ExcludeKeys ¶
ExcludeKeys creates a copy of the provided map filtering out the excluded `keys`
func Filter ¶
Filter creates a copy of the provided map, filtering out the elements that match `filter`. nil `filter` is accepted.
func Union ¶
Union returns a map constructed from the union of input maps. where values from latter maps win.
func UpdateKeys ¶
func UpdateKeys(m map[string]string, keys ...KeyPriority) map[string]string
UpdateKeys iterates over the lookups and updates entries in the map to use the default key
Types ¶
type KeyPriority ¶
type KeyPriority []string
KeyPriority is a utility struct for getting values from a map given a list of ordered keys
This is to help the migration/renaming of annotations & labels
func (KeyPriority) Get ¶
Get iterates over the ordered keys and looks up the corresponding values in the map
It returns the key, value, and true|false signaling whether the key was present in the map
If no key is present the default key (lowest ordinal) is returned with an empty string as the value
func (KeyPriority) Key ¶
func (p KeyPriority) Key() string
Key returns the default key that should be used for accessing the map
func (KeyPriority) UpdateKey ¶
func (p KeyPriority) UpdateKey(m map[string]string)
UpdateKey will update the map with the KeyPriority's default key iff any of the other synonym keys are present