interpolation

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interpolator

type Interpolator struct {
	// contains filtered or unexported fields
}

Interpolator handles variable interpolation

func NewInterpolator

func NewInterpolator(vars map[string]string, opts *Options) *Interpolator

NewInterpolator creates a new interpolator

func (*Interpolator) Clear

func (i *Interpolator) Clear()

Clear removes all variables

func (*Interpolator) GetVariables

func (i *Interpolator) GetVariables() map[string]string

GetVariables returns all variables

func (*Interpolator) Interpolate

func (i *Interpolator) Interpolate(text string) (string, error)

Interpolate expands variables in text

func (*Interpolator) InterpolateMap

func (i *Interpolator) InterpolateMap(data map[string]string) (map[string]string, error)

InterpolateMap interpolates all values in a map

func (*Interpolator) SetVariable

func (i *Interpolator) SetVariable(name, value string)

SetVariable sets a variable value

func (*Interpolator) SetVariables

func (i *Interpolator) SetVariables(vars map[string]string)

SetVariables sets multiple variables

type Options

type Options struct {
	FailOnMissing    bool // Fail if variable not found
	KeepUnresolved   bool // Keep ${VAR} if not found
	RecursiveResolve bool // Resolve variables in values
	MaxDepth         int  // Max recursion depth
}

Options for interpolation

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns default options

Jump to

Keyboard shortcuts

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