Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalNonStringFieldsFromJSON ¶
func UnmarshalNonStringFieldsFromJSON() mapstructure.DecodeHookFunc
Types ¶
type Decoder ¶
type Decoder[T any] struct { // Prefix optional prefix to add to keys when serializing. eg. "whatever.terra.bio/" Prefix string // TagName struct tag (default "key") TagName string }
Decoder can decode a simple struct into a map[string]string for use of Kubernetes annotations and labels. It also supports decoding a map[string]string back into a struct. Note that string fields are added to the map as-is; all other field types are encoded/decoded into a JSON string.
Structs with pointer fields are not supported. This has been tested for numeric, bool, and string datatypes; other data types might not work. (For example, runes definitely do not work because they are not supported by mapstructure).
Click to show internal directories.
Click to hide internal directories.