Documentation
¶
Index ¶
- func BoolParser(value string) (bool, error)
- func DurationParser(value string) (time.Duration, error)
- func EnumParser[T comparable](parser func(string) (T, error), allow ...T) func(string) (T, error)
- func Float32Parser(value string) (float32, error)
- func Float64Parser(value string) (float64, error)
- func Int8Parser(value string) (int8, error)
- func Int16Parser(value string) (int16, error)
- func Int32Parser(value string) (int32, error)
- func Int64Parser(value string) (int64, error)
- func IntParser(value string) (int, error)
- func JSONMapParser(value string) (map[string]any, error)
- func JSONSliceParser(value string) ([]any, error)
- func LoadEnv[T any](value string, fallback T, parser func(string) (T, error)) T
- func Must[T any](value T, err error) T
- func MustUnmarshal[T any](unmarshal func([]byte, any) error, src []byte) T
- func SliceParser[T any](parser func(string) (T, error)) func(string) ([]T, error)
- func StringParser(value string) (string, error)
- func TimeParser(value string) (time.Time, error)
- func Uint8Parser(value string) (uint8, error)
- func Uint16Parser(value string) (uint16, error)
- func Uint32Parser(value string) (uint32, error)
- func Uint64Parser(value string) (uint64, error)
- func UintParser(value string) (uint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolParser ¶
BoolParser is a parsing function for LoadEnv, that returns the boolean equivalent of the variable. For more information about supported value, refer to the documentation of strconv.ParseBool.
func DurationParser ¶
DurationParser is a parsing function for LoadEnv, that returns the time.Duration representation of the variable. For more information about supported value, refer to the documentation of time.ParseDuration.
func EnumParser ¶
func EnumParser[T comparable](parser func(string) (T, error), allow ...T) func(string) (T, error)
func Float32Parser ¶
Float32Parser is a parsing function for LoadEnv, that returns the float32 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseFloat.
func Float64Parser ¶
Float64Parser is a parsing function for LoadEnv, that returns the float64 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseFloat.
func Int8Parser ¶
Int8Parser is a parsing function for LoadEnv, that returns the int8 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseInt.
func Int16Parser ¶
Int16Parser is a parsing function for LoadEnv, that returns the int16 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseInt.
func Int32Parser ¶
Int32Parser is a parsing function for LoadEnv, that returns the int32 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseInt.
func Int64Parser ¶
Int64Parser is a parsing function for LoadEnv, that returns the int64 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseInt.
func IntParser ¶
IntParser is a parsing function for LoadEnv, that returns the int representation of the variable. For more information about supported value, refer to the documentation of strconv.Atoi.
func JSONMapParser ¶
JSONMapParser is a parsing function for LoadEnv, that returns the map[string]any representation of the variable. The parser expects the value to be a valid JSON object.
func JSONSliceParser ¶
JSONSliceParser is a parsing function for LoadEnv, that returns the []any representation of the variable. The parser expects the value to be a valid JSON array.
func LoadEnv ¶
LoadEnv cast an environment variable to a native Go type, using the provided Parser function. If parsing fails, the fallback value is returned.
func MustUnmarshal ¶
MustUnmarshal is a utility function that panics if the unmarshal operation fails.
func SliceParser ¶
SliceParser is a parsing function for LoadEnv, that returns a slice of values of type T. The parser accepts a sub-parser to define the type of T.
func StringParser ¶
StringParser is a parsing function for LoadEnv, that returns the string content of the variable, as-is.
func TimeParser ¶
TimeParser is a parsing function for LoadEnv, that returns the time.Time representation of the variable. The parser expects the time to be in time.RFC3339 format. For more information about supported value, refer to the documentation of time.Parse.
func Uint8Parser ¶
Uint8Parser is a parsing function for LoadEnv, that returns the uint8 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseUint.
func Uint16Parser ¶
Uint16Parser is a parsing function for LoadEnv, that returns the uint16 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseUint.
func Uint32Parser ¶
Uint32Parser is a parsing function for LoadEnv, that returns the uint32 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseUint.
func Uint64Parser ¶
Uint64Parser is a parsing function for LoadEnv, that returns the uint64 representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseUint.
func UintParser ¶
UintParser is a parsing function for LoadEnv, that returns the uint representation of the variable. For more information about supported value, refer to the documentation of strconv.ParseUint.
Types ¶
This section is empty.