env

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotKV           = errors.New("not an env key-value")
	ErrInvalidKVFormat = errors.New("invalid env key-value format")
	ErrUnmatchedQuote  = errors.New("unmatched quote in value")
)

Functions

func BatchSet added in v0.5.0

func BatchSet(m Map) error

func BatchUnset added in v0.5.0

func BatchUnset(keys []string) error

func Escape

func Escape(value string) string

func Expand

func Expand(value string) string

func Get

func Get(key string) string

func IsSet

func IsSet(key string) bool

func Lookup

func Lookup(key string) (string, bool)

func Marshal added in v0.4.0

func Marshal(value Map, options ...EncoderOption) ([]byte, error)

func Or

func Or(key, defaultValue string) string

func RawExpand added in v0.4.0

func RawExpand(value string, lookup LookupFunc) string

func RawGet added in v0.4.0

func RawGet(key string) string

func RawLookup added in v0.1.0

func RawLookup(key string) (string, bool)

func RawOr added in v0.4.0

func RawOr(key, defaultValue string) string

func Set added in v0.5.0

func Set(key, value string) error

func ToKey

func ToKey(key string) string

func Unescape added in v0.1.0

func Unescape(value string) string

func Unmarshal added in v0.1.0

func Unmarshal(data []byte, v any, options ...DecoderOption) error

func Unset added in v0.5.0

func Unset(key string) error

Types

type Decoder added in v0.4.0

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder added in v0.4.0

func NewDecoder(r io.Reader, options ...DecoderOption) *Decoder

func (*Decoder) Decode added in v0.4.0

func (d *Decoder) Decode(v any) error

type DecoderOption added in v0.4.0

type DecoderOption = func(d *Decoder)

func WithDecoderExpand added in v0.4.0

func WithDecoderExpand(val bool) DecoderOption

func WithDecoderLookup added in v0.4.0

func WithDecoderLookup(lookup LookupFunc) DecoderOption

type Encoder added in v0.4.0

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder added in v0.4.0

func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder

func (*Encoder) Encode added in v0.4.0

func (e *Encoder) Encode(v any) error

type EncoderOption added in v0.4.0

type EncoderOption = func(d *Encoder)

func WithEncoderExpand added in v0.4.0

func WithEncoderExpand(val bool) EncoderOption

func WithEncoderLookup added in v0.4.0

func WithEncoderLookup(lookup LookupFunc) EncoderOption

type ExpandFunc added in v0.4.0

type ExpandFunc = func(value string) string

type LookupFunc added in v0.4.0

type LookupFunc = func(value string) (string, bool)

type Map

type Map = map[string]string

func Environ

func Environ() (Map, error)

Jump to

Keyboard shortcuts

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