template

package
v0.7.2 Latest Latest
Warning

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

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

Documentation

Overview

Package template implements the variable substitution and templating engine used by workflow steps.

The engine resolves Go-style `{{ ... }}` expressions against an execution context that exposes workflow inputs (`{{ .input.* }}`) and prior step results (`{{ steps.<id>.* }}`). It supports both simple variable access (returning the underlying typed value) and full text-template rendering (returning a string), with a dedicated path for each so that argument passing preserves types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeContexts

func MergeContexts(contexts ...map[string]interface{}) map[string]interface{}

MergeContexts merges multiple contexts into a single context Later contexts override values from earlier contexts

Types

type Engine

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

Engine handles arg templating for service operations

func New

func New() *Engine

New creates a new template engine

func (*Engine) ExtractVariables

func (e *Engine) ExtractVariables(value interface{}) []string

ExtractVariables extracts all template variable names from a value

func (*Engine) RenderGoTemplate

func (e *Engine) RenderGoTemplate(templateStr string, context map[string]interface{}) (interface{}, error)

RenderGoTemplate renders a full Go template with Sprig template functions This is used for complex expressions like {{ eq .input.var "value" }}

func (*Engine) Replace

func (e *Engine) Replace(value interface{}, context map[string]interface{}) (interface{}, error)

Replace replaces all template variables in a value with actual values from the context

func (*Engine) ValidateContext

func (e *Engine) ValidateContext(value interface{}, context map[string]interface{}) error

ValidateContext ensures all required variables are present in the context

Jump to

Keyboard shortcuts

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