loopexpander

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package loopexpander provides template substitution utilities for loop observations. This is a pure utility package with no domain or infrastructure dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupNestedVar

func LookupNestedVar(vars map[string]interface{}, path string) (interface{}, error)

LookupNestedVar looks up a variable value by path (e.g., "config.path").

func ResolveLoopItems

func ResolveLoopItems(itemsExpr string, vars map[string]interface{}) ([]interface{}, error)

ResolveLoopItems extracts the list of items from a loop.items template expression. It expects the expression to be in the form "{{ .vars.xxx }}" and looks up the value.

func SubstituteLoopInMap

func SubstituteLoopInMap(m map[string]interface{}, loopCtx *Context, customName string) map[string]interface{}

SubstituteLoopInMap recursively substitutes loop variables in map values.

func SubstituteLoopInString

func SubstituteLoopInString(str string, loopCtx *Context, customName string) string

SubstituteLoopInString replaces loop variable patterns in a string.

Types

type Context

type Context struct {
	Item   interface{}
	Index  int
	First  bool
	Last   bool
	Length int
}

Context provides loop iteration context for template substitution.

Jump to

Keyboard shortcuts

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