introducing a registry into the decoder config so as to make it possible to dynamically determine what native go structure to decode the map[string]interface{} into
Changing function name from GetType() to TypeName() to be more in line
with go naming standards
adding another method to the decoder config to set the entire registry
fixes from PR feedback
- avoiding type assertion when trying to read the string from the value
- introducing a TypeRegistry struct to simplify how we add to a registry
updating comment
- fix comment
removing newline
- ensuring that the same type is not registered more than once
- using pointers for method definitons for TypeRegistry
Merge pull request #1 from SpruceHealth/registry

This extends the capabilities of mapstructure to dynamically determine the type of the go structure based on a type field in the map[string]interface{}, rather only being able to provide the top level type at the time of decode.

Defining a Typed interface which any struct has to implement in order to be registered as a potential structure to decode into.

The DecoderConfig now has a registry variable which is intentionally not exposed outside the package. Instead, a RegisterType method is provided on the decoder config to ensure that the registry only contains mappings for structures that implement the Typed interface.