SpruceHealth/mapstructure — pull request #1 by kunaljham (2014-04-19 17:00:52+00:00)
Title: Dynamically determining go native structure type from registry when decoding

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.