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 ¶
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.
Click to show internal directories.
Click to hide internal directories.