viper

package module
v1.2.112 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeProtoJsonHook

func DecodeProtoJsonHook(v proto.Message) viper.DecoderConfigOption

DecodeProtoJsonHook if set, will be called before any decoding and any type conversion (if WeaklyTypedInput is on). This lets you modify the values before they're set down onto the resulting struct.

If an error is returned, the entire decode will fail with that error.

func Unmarshal

func Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error

Unmarshal unmarshalls the config into a Struct. Make sure that the tags on the fields of the structure are properly set. use protojson to decode if rawVal is proto.Message

func UnmarshalExact

func UnmarshalExact(rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent in the destination struct. use protojson to decode if rawVal is proto.Message

func UnmarshalExactViper

func UnmarshalExactViper(v *viper.Viper, rawVal interface{}, opts ...viper.DecoderConfigOption) error

func UnmarshalKey

func UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalKey takes a single key and unmarshalls it into a Struct. use protojson to decode if rawVal is proto.Message

func UnmarshalKeyViper

func UnmarshalKeyViper(v *viper.Viper, key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

func UnmarshalKeys

func UnmarshalKeys(keys []string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

func UnmarshalKeysExactViper added in v1.2.67

func UnmarshalKeysExactViper(v *viper.Viper, keys []string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

func UnmarshalKeysViper

func UnmarshalKeysViper(v *viper.Viper, keys []string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

func UnmarshalProtoMessageHookFunc

func UnmarshalProtoMessageHookFunc(def proto.Message) mapstructure.DecodeHookFunc

UnmarshalProtoMessageHookFunc returns a DecodeHookFunc that converts root struct to config.ViperProto. Trick of protobuf, which generates json tag only def is the default value of dst

func UnmarshalViper

func UnmarshalViper(v *viper.Viper, rawVal interface{}, opts ...viper.DecoderConfigOption) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL