environment

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("not supported")

ErrNotSupported when operation is not supported.

Functions

This section is empty.

Types

type Check

type Check Pair

Check is used to verify environment values.

type Key

type Key string

Key is an environment key.

type Pair

type Pair struct {
	Key
	Value
}

Pair holds a pair of environment key and value.

func NewPair

func NewPair(environ string) Pair

NewPair creates a pair from os.Environ style string.

type Value

type Value string

Value is an environment value.

type Values

type Values map[Key]Value

Values holds environment values together with their keys.

func Current

func Current() Values

Current returns current environment values, from os.Environ method.

func New

func New(environ ...string) Values

New returns an environmental values bases on input compatible with the os.Environ function.

func (Values) Add

func (v Values) Add(pair Pair)

Add a pair to environment values.

type ValuesSupplier

type ValuesSupplier func() Values

ValuesSupplier is a func that supplies environmental values.

type VersionResolver

type VersionResolver struct {
	VersionKey   Key
	IsApplicable []Check
	ValuesSupplier
}

VersionResolver is used to resolve version information solely on environment variables.

func NewVersionResolver

func NewVersionResolver(options ...VersionResolverOption) VersionResolver

NewVersionResolver creates a VersionResolver using options.

func (VersionResolver) IsLatest

func (e VersionResolver) IsLatest(_ string) (bool, error)

func (VersionResolver) Version

func (e VersionResolver) Version() string

type VersionResolverOption

type VersionResolverOption func(*VersionResolver)

VersionResolverOption is used to customize creation of VersionResolver.

func WithValuesSupplier

func WithValuesSupplier(vs ValuesSupplier) VersionResolverOption

WithValuesSupplier allows to set the values supplier.

Jump to

Keyboard shortcuts

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