genv

package
v0.0.0-...-bd4000b Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvVariables = make(map[string]*EnvVariable)

EnvVariables is where environment variables are stored.

Functions

func Load

func Load(path ...string) (err error)

Load method allows environment variables to be loaded from the desired file.

dotenv.Load(".envfile")

Types

type EnvVariable

type EnvVariable struct {
	Key          string
	Val          string
	DefaultValue interface{}
	IsDefined    bool
}

EnvVariable contains information about the environment variable, such as key, value, and default value.

func Key

func Key(key string) *EnvVariable

Key is used to determine the path of the environment variable to be accessed.

genv.Key("env-key").String()

func (*EnvVariable) Bool

func (e *EnvVariable) Bool() bool

Bool method is used for environment variables of type bool.

genv.Key("env-key").Bool()

func (*EnvVariable) Default

func (e *EnvVariable) Default(defaultValue interface{}) *EnvVariable

Default is used to specify the default value for the environment variable to be accessed.

genv.Key("env-key").Default("defaultValue").String()

func (*EnvVariable) Float

func (e *EnvVariable) Float() float64

Float method is used for environment variables of type float.

genv.Key("env-key").Float()

func (*EnvVariable) Int

func (e *EnvVariable) Int() int

Int method is used for environment variables of type int.

genv.Key("env-key").Int()

func (*EnvVariable) String

func (e *EnvVariable) String() string

String method is used for environment variables of type string.

genv.Key("env-key").String()

func (*EnvVariable) Update

func (e *EnvVariable) Update(value interface{})

Update is used to update the value of the corresponding environment variable.

genv.Key("env-key").Update("updatedValue")

Jump to

Keyboard shortcuts

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