env

package module
v0.0.0-...-494dd1a Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

README

Env

Go Reference

A generic typed implementation of environment variables.

package env // import "go.linka.cloud/env"


// FUNCTIONS

func Get[T Value](name string) T
func GetDefault[T Value](key string, defaultVal T) T
func GetSlice[T Value](name string) []T
func GetSliceDefault[T Value](name string, def []T) []T
func Set[T Value](name string, v T) error
func SetSlice[T Value](name string, v []T) error
func Unset(name string) error

// TYPES

type Value interface {
float32 | float64 |
uint | uint8 | uint16 | uint32 | uint64 |
int | int8 | int16 | int32 | int64 |
bool |
string |
time.Time | time.Duration |
net.IP | net.IPNet | netip.Addr | netip.Prefix | netip.AddrPort
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T Value](name string) T

func GetDefault

func GetDefault[T Value](key string, defaultVal T) T

func GetSlice

func GetSlice[T Value](name string) []T

func GetSliceDefault

func GetSliceDefault[T Value](name string, def []T) []T

func Set

func Set[T Value](name string, v T) error

func SetSlice

func SetSlice[T Value](name string, v []T) error

func Unset

func Unset(name string) error

Types

type Value

type Value interface {
	float32 | float64 |
		uint | uint8 | uint16 | uint32 | uint64 |
		int | int8 | int16 | int32 | int64 |
		bool |
		string |
		time.Time | time.Duration |
		net.IP | net.IPNet | netip.Addr | netip.Prefix | netip.AddrPort
}

Jump to

Keyboard shortcuts

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