Documentation ¶
Overview ¶
Code generated by "envopts -type=FooEnv"; DO NOT EDIT.
Code generated by "envopts -type=fooEnv -optionType=PrivOption -output=private_foo_env.go"; DO NOT EDIT.
Code generated by "envopts -type=RabEnv -optionType=RabOption"; DO NOT EDIT.
Index ¶
- func RunBar(be BarEnv)
- type BarEnv
- type FooEnv
- type Option
- func FromFooEnv(v *FooEnv) Option
- func ParseEnv(eo env.Options) (opts []Option, err error)
- func WithDar(v []env.Options) Option
- func WithDuration(v time.Duration) Option
- func WithFoo(v []env.Options) Option
- func WithHome(v string) Option
- func WithHosts(v []string) Option
- func WithIsProduction(v bool) Option
- func WithPassword(v string) Option
- func WithPort(v int) Option
- func WithTempFolder(v string) Option
- type PrivOption
- type RabEnv
- type RabOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BarEnv ¶
type BarEnv struct {
// contains filtered or unexported fields
}
BarEnv is one with a private field should result in nothing being generated
type FooEnv ¶
type FooEnv struct { Home string `env:"HOME"` Port int `env:"PORT" envDefault:"3000"` Password string `env:"PASSWORD,unset"` IsProduction bool `env:"PRODUCTION"` Hosts []string `env:"HOSTS" envSeparator:":"` Duration time.Duration `env:"DURATION"` TempFolder string `env:"TEMP_FOLDER" envDefault:"${HOME}/tmp" envExpand:"true"` // test external package and one tag for multiple fields Foo, Dar []env.Options `env:"FOO"` }
func ApplyOptions ¶
ApplyOptions will merge all options into the resulting FooEnv while also ensuring default values are always set.
type Option ¶
type Option func(*FooEnv)
Option is a functional option to configure FooEnv
func FromFooEnv ¶
FromFooEnv takes fully configured FooEnv and returns it as an option. Can be used to parse environment variables manually and provide the result in places where an option argument is expected.
type PrivOption ¶
type PrivOption func(*fooEnv)
PrivOption is a functional option to configure fooEnv
func PrivOptionParseEnv ¶
func PrivOptionParseEnv(eo env.Options) (opts []PrivOption, err error)
PrivOptionParseEnv will parse environment variables into a slice of options. Any options for parsing the environment can be supplied, for example to parse under a prefix.
func WithDurationPrivOption ¶
func WithDurationPrivOption(v time.Duration) PrivOption
WithDurationPrivOption configures fooEnv
func WithHostsPrivOption ¶
func WithHostsPrivOption(v []string) PrivOption
WithHostsPrivOption configures fooEnv
type RabEnv ¶
type RabEnv struct {
Home string `env:"HOME"` // User's home directory
}
func ApplyRabOptions ¶
ApplyRabOptions will merge all options into the resulting RabEnv while also ensuring default values are always set.
type RabOption ¶
type RabOption func(*RabEnv)
RabOption is a functional option to configure RabEnv
func FromRabEnv ¶
FromRabEnv takes fully configured RabEnv and returns it as an option. Can be used to parse environment variables manually and provide the result in places where an option argument is expected.
func RabOptionParseEnv ¶
RabOptionParseEnv will parse environment variables into a slice of options. Any options for parsing the environment can be supplied, for example to parse under a prefix.
func WithHomeRabOption ¶
WithHomeRabOption configures: User's home directory