mirror of https://github.com/spf13/viper.git
Better naming of the Marshal functionality.
This commit is contained in:
parent
1cebee8d97
commit
c5a9056e3b
8
viper.go
8
viper.go
|
@ -96,13 +96,13 @@ func GetStringMapString(key string) map[string]string {
|
||||||
return cast.ToStringMapString(Get(key))
|
return cast.ToStringMapString(Get(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
// takes a map and uses reflection to convert it into the given Go native structure.
|
// Takes a single key and marshals it into a Struct
|
||||||
// rawVal must be a pointer to a struct.
|
func MarshalKey(key string, rawVal interface{}) error {
|
||||||
func GetIntoStruct(key string, rawVal interface{}) error {
|
|
||||||
return mapstructure.Decode(Get(key), rawVal)
|
return mapstructure.Decode(Get(key), rawVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAllIntoStruct(rawVal interface{}) (err error) {
|
// Marshals the config into a Struct
|
||||||
|
func Marshal(rawVal interface{}) (err error) {
|
||||||
err = mapstructure.Decode(defaults, rawVal)
|
err = mapstructure.Decode(defaults, rawVal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue