Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes generic map values from `input` to `output`, while providing helpful error information. `output` must be a pointer to a Go struct that contains `mapstructure` struct tags on fields that should be decoded. This function is useful when decoding values from configuration files parsed as `map[string]any` or component metadata as `map[string]string`.
Most of the heavy lifting is handled by the mapstructure library. A custom decoder is used to handle decoding string values to the supported primitives.
Types ¶
type FromStringer ¶
type StringDecoder ¶
StringDecoder is used as a way for custom types (or alias types) to override the basic decoding function in the `decodeString` DecodeHook. `encoding.TextMashaller` was not used because it matches many Go types and would have potentially unexpected results. Specifying a custom decoding func should be very intentional.