Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Env ¶
func Env[T EnvDefaults](key string, defaultValue T) T
Env retrieves the value of the environment variable named by the key.
If the variable is not set, or if the conversion fails due to incorrect value, a default value is returned.
func GetEnv ¶
func GetEnv[T EnvDefaults](key string) Option[T]
GetEnv retrieves the value of the environment variable named by the key.
If the variable is not set, or if the conversion fails it returns `None`, otherwise `Some`.
func LookupEnv ¶
func LookupEnv[T EnvDefaults](key string) Result[Option[T], error]
LookupEnv retrieves the value of the environment variable named by the key.
If the variable is not present it returns Ok(None) If the variable is present and conversion is successful, the value Ok(Some) is returned If the variable is present and conversion fails it returns Err(error)
Types ¶
type EnvDefaults ¶
type EnvDefaults interface {
constraintsext.Number | ~string
}
EnvDefaults interface defines the supported types that can be used for environment variables conversions.