env

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package env implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string) string

GetEnv retrieves the value of an environment variable with the given key.

func LookupEnv added in v0.2.15

func LookupEnv(key string) (string, bool)

LookupEnv retrieves the value of an environment variable with the given key.

func SetEnv

func SetEnv(key, value string) error

SetEnv sets an environment variable with the given key and value. The key is converted to uppercase before setting the environment variable.

func Var

func Var(vv ...string) string

Var constructs a string by joining the given string slices with underscores and converting to uppercase.

Types

type Env added in v0.2.15

type Env interface {
	// Var constructs a string by joining the given string slices with underscores and converting to uppercase.
	Var(...string) string
	// LookupEnv retrieves the value of an environment variable with the given key.
	LookupEnv(string) (string, bool)
	// SetEnv sets an environment variable with the given key and value.
	SetEnv(string, string) error
	// GetEnv retrieves the value of an environment variable with the given key.
	GetEnv(string) string
}

Env is an interface that provides methods for working with environment variables. It includes methods for looking up, setting, and getting environment variables.

func WithPrefix added in v0.2.15

func WithPrefix(prefix string) Env

WithPrefix creates a new Env instance with the given prefix.

Jump to

Keyboard shortcuts

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