Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Map ¶
type Map map[string]string
Map is a wrapper around map[string]string that provides some helpers above it that assume the map is in the format that flatmap expects (the result of Flatten).
All modifying functions such as Delete are done in-place unless otherwise noted.
func Flatten ¶
func Flatten(thing map[string]interface{}) Map
Flatten takes a structure and turns into a flat map[string]string.
Within the "thing" parameter, only primitive values are allowed. Structs are not supported. Therefore, it can only be slices, maps, primitives, and any combination of those together.
See the tests for examples of what inputs are turned into.
func (Map) Contains ¶
func (m Map) Contains(key string) bool
Contains returns true if the map contains the given key.
func (Map) Delete ¶
func (m Map) Delete(prefix string)
Delete deletes a key out of the map with the given prefix.
func (Map) Merge ¶
func (m Map) Merge(m2 Map)
Merge merges the contents of the other Map into this one.
This merge is smarter than a simple map iteration because it will fully replace arrays and other complex structures that are present in this map with the other map's. For example, if this map has a 3 element "foo" list, and m2 has a 2 element "foo" list, then the result will be that m has a 2 element "foo" list.