Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRecursiveLoop means a variable substitution has some self-referring // variables, either directly or indirectly. ErrRecursiveLoop = errors.New("recursive variable loop") )
Functions ¶
Types ¶
type Source ¶
type Source interface { // Lookup tries to look up a value based on name and returns that value as // well as true on success, or false if the variable was not found. Lookup(name string) (Var, bool) // ListVars will return a slice of all variables that this varsub Source // provides. ListVars() []Var }
Source is a variable substitution source.
func NewOSEnvSource ¶
NewOSEnvSource creates a new Source that uses your OS environment variables with a prefix as variables.
To use all environment variables, you can specify an empty string as prefix.
type SourceMap ¶
SourceMap is a variable substitution source based on a map where it uses the underlying map as the variable source.
type SourceSlice ¶
type SourceSlice []Source
SourceSlice is a slice of variable substution sources that act as a source itself by returning the first successful lookup.
func (SourceSlice) ListVars ¶
func (s SourceSlice) ListVars() []Var
ListVars will return a slice of all variables that this varsub Source provides.
type Val ¶
Val is a slimmed down varsub.Var, without the Key, as the SourceMap will populate the Key field automatically based on the map keys.
type Var ¶
Var is a single varsub variable, with it's Key (name), Value, and optionally also a Source that declares where this variable comes from.