Categorygithub.com/gernoteger/mapstructure-hooks
modulepackage
1.1.1
Repository: https://github.com/gernoteger/mapstructure-hooks.git
Documentation: pkg.go.dev

# README

GoDoc Go Report Card Build Status

About

This is a small extension to Mitshell Hashimoto's excellent library mapstructure. It allows one to fill arrays of interfaces whose concrete type is determined by their content. A typical usecase is configuring log handlers from a yaml file and processing the imported map through mapstructure.

The design was heavily inspired by logrus_mate

Usage

For a detailled description look at the examples in the godocs.

# Packages

No description provided by the author

# Functions

Decode transkripts map[interface{}]interface{} to the target struct.
DecodeElementsHookFunc returns a DecodeHookFunc that converts maps to a Hook config derived from a registry.
DefaultDecoderConfig returns default mapstructure.DecoderConfig with support of time.Duration values and Plugins.
InitRegistry resets the registry.
Register registers the factory function for all instances of a given type hint: provide a type for consumers with MyHookType := reflect.TypeOf((*MyHook)(nil)).Elem().
RegisterInterface registers a new interface type; must only be called once!.
StringToStringUnmarshallerHookFunc returns a DecodeHookFunc that converts strings by an unmarshaller.

# Type aliases

NewHookFunc creates a new instance for an registered interface.