Documentation
¶
Overview ¶
Package template provides template expansion actions for the operation graph.
Index ¶
Constants ¶
const ( RenderBytes op.ActionName = "template.render_bytes" RenderText op.ActionName = "template.render_text" )
Action-name constants for the template provider's plan-mode actions.
Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
op.ProviderBase
}
Provider provides template expansion actions.
It takes input content and produces output content through Go template expansion — no filesystem access.
func NewProvider ¶
func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider
NewProvider creates a template provider bound to the given runtime environment.
func (*Provider) RenderBytes ¶
RenderBytes processes content as a Go text/template and returns the rendered bytes.
Parameters:
- `content`: the template source bytes.
- `data`: key-value pairs available as template variables.
Returns:
- `[]byte`: the rendered output bytes.
- `error`: non-nil when the template fails to parse or execute.
func (*Provider) RenderText ¶
RenderText processes content as a Go text/template and returns the rendered string.
Parameters:
- `content`: the template source text.
- `data`: key-value pairs available as template variables.
Returns:
- `string`: the rendered output text.
- `error`: non-nil when the template fails to parse or execute.