package interpolation
import "github.com/compose-spec/compose-go/interpolation"
Index ¶
- Constants
- func Interpolate(config map[string]interface{}, opts Options) (map[string]interface{}, error)
- type Cast
- type LookupValue
- type Options
- type Path
Constants ¶
const PathMatchAll = "*"
PathMatchAll is a token used as part of a Path to match any key at that level in the nested structure
const PathMatchList = "[]"
PathMatchList is a token used as part of a Path to match items in a list
Functions ¶
func Interpolate ¶
Interpolate replaces variables in a string with the values from a mapping
Types ¶
type Cast ¶
Cast a value to a new type, or return an error if the value can't be cast
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[Path]Cast // Substitution function to use Substitute func(string, template.Mapping) (string, error) }
Options supported by Interpolate
type Path ¶
type Path string
Path is a dotted path of keys to a value in a nested mapping structure. A * section in a path will match any key in the mapping structure.
func NewPath ¶
NewPath returns a new Path
func (Path) Next ¶
Next returns a new path by append part to the current path
Source Files ¶
- Version
- v1.13.4
- Published
- Apr 20, 2023
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 2 hours ago –
Tools for package owners.