template

package
v0.3.7 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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