Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandPrefixed ¶
ExpandPrefixed takes a maps and a prefix and expands that value into a more complex structure. This is the reverse of the Flatten operation.
func Merge ¶ added in v1.141.0
func Merge[K comparable, T any](m ...map[K]T) map[K]T
Merge merges multiple maps into a new map. Later maps override earlier ones on key conflicts. Nil maps are ignored.
Types ¶
type Map ¶
Map is a wrapper around maps[string]string that provides some helpers above it that assume the maps 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 ¶
Flatten takes a structure and turns into a flat maps[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) Merge ¶
Merge merges the contents of the other Map into this one.
This merge is smarter than a simple maps iteration because it will fully replace arrays and other complex structures that are present in this map with the other maps's. For example, if this maps 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.