WithDecodeHook sets a default decode hook for mapstructure.
(h mapstructure.DecodeHookFunc)
| 260 | |
| 261 | // WithDecodeHook sets a default decode hook for mapstructure. |
| 262 | func 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. |
| 273 | func NewWithOptions(opts ...Option) *Viper { |