Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TextMarshalerHookFunc ¶
func TextMarshalerHookFunc() mapstructure.DecodeHookFuncValue
TextMarshalerHookFunc returns a DecodeHookFuncValue that checks for the encoding.TextMarshaler interface and calls the MarshalText function if found.
func YamlMarshalerHookFunc ¶ added in v0.103.0
func YamlMarshalerHookFunc() mapstructure.DecodeHookFuncValue
YamlMarshalerHookFunc returns a DecodeHookFuncValue that checks for structs that have yaml tags but no mapstructure tags. If found, it will convert the struct to map[string]any using the yaml package, which respects the yaml tags. Ultimately, this allows mapstructure to later marshal the map[string]any in a generic way.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder takes structured data and converts it into an interface following the mapstructure tags.
type EncoderConfig ¶
type EncoderConfig struct { // EncodeHook, if set, is a way to provide custom encoding. It // will be called before structs and primitive types. EncodeHook mapstructure.DecodeHookFunc }
EncoderConfig is the configuration used to create a new encoder.
Click to show internal directories.
Click to hide internal directories.