env

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 7

README

go-env

Go Reference

This is a fork of github.com/graymeta/env

Environment Variable Parsing with Default Values

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(key string, defaultValue bool) bool

Bool returns a value from an environment variable defined by key. If key isn't set in the environment, returns defaultValue

func Duration

func Duration(key string, defaultValue time.Duration) time.Duration

Duration returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as a time.Duration, returns defaultValue

func Float32 added in v0.0.6

func Float32(key string, defaultValue float32) float32

Float32 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as a float32, returns defaultValue

func Float64

func Float64(key string, defaultValue float64) float64

Float64 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as a float64, returns defaultValue

func Int

func Int(key string, defaultValue int) int

Int returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an int, returns defaultValue

func Int8 added in v0.0.6

func Int8(key string, defaultValue int8) int8

Int8 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an int8, returns defaultValue

func Int16 added in v0.0.6

func Int16(key string, defaultValue int16) int16

Int16 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an int16, returns defaultValue

func Int32 added in v0.0.6

func Int32(key string, defaultValue int32) int32

Int32 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an int32, returns defaultValue

func Int64 added in v0.0.4

func Int64(key string, defaultValue int64) int64

Int64 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an int64, returns defaultValue

func String

func String(key string, defaultValue string) string

String returns a value from an environment variable defined by key. If key isn't set in the environment, returns defaultValue

func Uint added in v0.0.6

func Uint(key string, defaultValue uint) uint

Uint returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an uint8, returns defaultValue

func Uint8 added in v0.0.5

func Uint8(key string, defaultValue uint8) uint8

Uint8 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an uint8, returns defaultValue

func Uint16 added in v0.0.5

func Uint16(key string, defaultValue uint16) uint16

Uint16 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an uint16, returns defaultValue

func Uint32 added in v0.0.5

func Uint32(key string, defaultValue uint32) uint32

Uint32 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an uint32, returns defaultValue

func Uint64 added in v0.0.5

func Uint64(key string, defaultValue uint64) uint64

Uint64 returns a value from an environment variable defined by key. If key isn't set in the environment, or doesn't parse as an uint64, returns defaultValue

Types

This section is empty.

Jump to

Keyboard shortcuts

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