Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interpolate ¶
Interpolate replaces variables in a string with the values from a mapping. Every failure is collected into a single joined error, sorted by config path, rather than returning the first one. There is one error per failing config value: if a value holds several failing variable references, only the first one is reported. The walk continues past failures, so LookupValue, Substitute and Cast may run on values dropped from the result.
Types ¶
type LookupValue ¶
LookupValue is a function which maps from variable names to values. Returns the value as a string and a bool indicating whether the value is present, to distinguish between an empty string and the absence of a value.
type Options ¶
type Options struct {
// LookupValue from a key
LookupValue LookupValue
// TypeCastMapping maps key paths to functions to cast to a type
TypeCastMapping map[tree.Path]Cast
// Substitution function to use
Substitute func(string, template.Mapping) (string, error)
}
Options supported by Interpolate