Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var VariablePattern = regexp.MustCompile(`\$\{([A-Z][A-Z0-9_]*)\}`)
VariablePattern matches ${VAR_NAME} syntax
Functions ¶
func ApplyTypeCorrections ¶
func ApplyTypeCorrections(data interface{}, r *Resolver) interface{}
ApplyTypeCorrections walks a parsed JSON/YAML value and converts string values that were produced by integer-typed variable interpolation back to Go integers, ensuring they encode as JSON numbers rather than quoted strings.
func ExtractAllVariables ¶
ExtractAllVariables scans multiple strings and returns all unique variable names
func ExtractVariables ¶
ExtractVariables finds all ${VAR_NAME} patterns in a string and returns unique variable names
func HasVariables ¶
HasVariables checks if a string contains any ${VAR_NAME} patterns
Types ¶
type Resolver ¶
type Resolver struct {
// Variables tracks all discovered variables and their values
Variables map[string]string
// Generated tracks which variables were auto-generated (not from env)
Generated map[string]bool
// VarTypes holds declared types for variables from a VARS block ("uuid", "integer", "string", "enum")
VarTypes map[string]string
// VarConstraints holds per-variable key=value constraint maps from a VARS block
VarConstraints map[string]map[string]string
}
Resolver handles environment variable substitution with generated values
func NewResolver ¶
func NewResolver() *Resolver
NewResolver creates a new Resolver with empty variable sets
func (*Resolver) DeclareVariable ¶
DeclareVariable records a type declaration and optional constraints for a variable and pre-generates its value. Called by the DSL parser when it processes a VARS block.
func (*Resolver) FormatVarMap ¶
FormatVarMap returns a human-readable summary of all resolved variables, suitable for appending to a test failure message to aid debugging.
func (*Resolver) GetGeneratedEnv ¶
GetGeneratedEnv returns environment variable assignments for all generated values This is used to inject variables into containers