MCPcopy
hub / github.com/spf13/viper / WithDecodeHook

Function WithDecodeHook

viper.go:262–270  ·  view source on GitHub ↗

WithDecodeHook sets a default decode hook for mapstructure.

(h mapstructure.DecodeHookFunc)

Source from the content-addressed store, hash-verified

260
261// WithDecodeHook sets a default decode hook for mapstructure.
262func WithDecodeHook(h mapstructure.DecodeHookFunc) Option {
263 return optionFunc(func(v *Viper) {
264 if h == nil {
265 return
266 }
267
268 v.decodeHook = h
269 })
270}
271
272// NewWithOptions creates a new Viper instance.
273func NewWithOptions(opts ...Option) *Viper {

Callers 1

Calls 1

optionFuncFuncType · 0.85

Tested by 1