env

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotPair         = errors.New("not a key-value pair")
	ErrBadKey          = errors.New("bad key")
	ErrUnmatchedQuote  = errors.New("unmatched quote in value")
	ErrInvalidEncoding = errors.New("invalid UTF-8 string")
)

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, def string) string

func ParseKey added in v0.8.0

func ParseKey(s string) (string, error)

func ParseLine added in v0.8.0

func ParseLine(line string) (key, val string, err error)

func ParseValue added in v0.8.0

func ParseValue(s string) (string, error)

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, def 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(e *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)

func ParseMap added in v0.8.0

func ParseMap(e Map) (m Map, err error)

Jump to

Keyboard shortcuts

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