Documentation
¶
Overview ¶
Package template renders Go text/template strings against a workflow.RenderCtx. Strict missing-key handling so typos surface as errors instead of `<no value>`. Used by every executor that needs to interpolate {{.Event.X}} / {{.Node.X.Y}} / {{.Env.X}} / {{.Secret.X}}.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BuiltinFuncDocs = map[string]string{
"truncate n str": "truncate str to n chars, appends '…'",
"upper str": "uppercase",
"lower str": "lowercase",
"trim str": "trim whitespace",
"default d v": "return v if non-empty, else d",
"toJSON v": "marshal any value to JSON string — safe for body: fields (aliases: toJson, tojson)",
"fromJSON s": "parse JSON string to map/slice/scalar — use to read fields out of stringified JSON (aliases: fromJson, fromjson)",
"jsonEscape str": "escape string for embedding inside a JSON string literal",
"now format": "current UTC time — format uses Go ref time e.g. '2006-01-02T15:04:05Z07:00'",
}
BuiltinFuncDocs is the single source of truth for available template functions. Key = "funcname signature", Value = description. Exposed via workflow_workspace so AI always sees the up-to-date list.
View Source
var BuiltinFuncs = gotemplate.FuncMap{ "truncate": func(n int, s string) string { if len(s) <= n { return s } return s[:n] + "…" }, "upper": strings.ToUpper, "lower": strings.ToLower, "trim": strings.TrimSpace, "default": func(d, v any) any { if v == nil || v == "" { return d } return v }, "toJSON": toJSON, "toJson": toJSON, "tojson": toJSON, "fromJSON": fromJSON, "fromJson": fromJSON, "fromjson": fromJSON, "jsonEscape": func(s string) string { b, _ := json.Marshal(s) return string(b[1 : len(b)-1]) }, "now": func(format string) string { if format == "" { format = time.RFC3339 } return time.Now().UTC().Format(format) }, }
BuiltinFuncs are convenience template funcs available in every Render.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.