Documentation ¶
Overview ¶
Package gev implements functionality to unmarshal environment variables into struct fields.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
func Unmarshal(v interface{}) error
Unmarshal inspects the process' environment for values that match `env` tags on v, and parses the values into the fields of v.
Unmarshal can unmarshal environment variable values into the following types:
bool, int64, float64, string and []byte
Further, it supports pointers to bool, int64, float64, string types. In the case of bool, int64 and float64, nil will be unmarshaled if the enviroment variable does not exist, or its value is the empty string.
Unmarshal targets exported fields, and checks the gev tag value. It uses the following rules:
// Field will contain the value of FOO environment variable Field string `env:"FOO"` // field will be ignored by Unmarshal as it's unexported field int // Filed will be ignored by Unmarshal Field bool `env:"-"`
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.