sprig
sprig copied to clipboard
FeatureRequest: serialize map
I have a use for needing to easily serialize a map[string]string given a sep and assign. I need it for a helm chart where I want to serialize a yaml map into an env var of the form key:value,key2:value which will then be auto deserialized into a map with https://github.com/kelseyhightower/envconfig.
Do you think others might find this useful? I want to add it here because helm uses this lib for utility functions in templates. If you're willing to add such a function here I'd be happy to create a PR.
I would make the implementation similar to the join (join: strings.Join, but as join SEP SLICE) function currently supported.
something like joinMap SEP ASSIGN MAP
and then joinMap "," ":" map[string][string]{"a":"b", "c", "d"} results in a:b,c:d