Documentation
¶
Overview ¶
Package dchook holds the reflection logic shared by poya's mapstructure decode hooks. It deliberately imports no mapstructure package so the same code backs both the mitchellh/mapstructure hooks (package hooks) and the go-viper/mapstructure/v2 hooks (package mapstructurev2). The exported functions all use the (from, to reflect.Value) (any, error) shape that both mapstructure forks accept as a DecodeHookFuncValue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hook ¶
Hook implements the general decode hook: it detects a target *poya.DcValue[T] and initializes it from the source, handling scalar, time.Duration, time.Time, struct, and slice kinds. Non-matching values pass through unchanged.
func JSONString ¶
JSONString decodes a JSON string source (a struct or array stored as a single config value) into a struct or slice DcValue[T]. Non-matching values pass through unchanged.
func StringToDcValue ¶
StringToDcValue handles only string sources targeting a DcValue[T] with a non-string scalar T (int, uint, float, bool, complex, time.Duration, time.Time, or any encoding.TextUnmarshaler). Non-matching values pass through unchanged so it can be composed with other hooks.
Types ¶
This section is empty.