template

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package template provides a reusable Go text-template renderer and exposes it to Flow as the template.render action.

Typical use:

template.render @{ template: "Hello {{.name}}", variables: { name: "Flow" } }

Index

Constants

View Source
const ID = "template"

Variables

View Source
var RenderAction = action.New("template.render", func(_ context.Context, req RenderRequest) (string, error) {
	result, err := flowtemplate.Render(req.Template, req.Variables)
	if err != nil {
		return "", xerr.BadRequest(err.Error())
	}
	return result, nil
}).Description("Render a text template with supplied variables").
	Example(RenderRequest{
		Template:  "Hello {{.name}}",
		Variables: map[string]any{"name": "Flow"},
	}).Build()

RenderAction exposes the package-agnostic renderer to Flow workflows.

Functions

func Bundle

func Bundle(_ map[string]string) core.Bundle

Bundle exposes the template.render action to Flow.

func Library

func Library() action.Library

Library returns the action library without requiring registry lookup.

Types

type RenderRequest

type RenderRequest struct {
	Template  string         `json:"template" cli:"template"`
	Variables map[string]any `json:"variables" cli:"variables"`
}

RenderRequest is the input shape for the template.render Flow action.

Jump to

Keyboard shortcuts

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