template

package
v0.1.0-dev.20260817203828 Latest Latest
Warning

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

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

Documentation

Overview

Package template provides template expansion actions for the operation graph.

Index

Constants

View Source
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.

+devlore:access=both

func NewProvider

func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider

NewProvider creates a template provider bound to the given runtime environment.

func (*Provider) RenderBytes

func (p *Provider) RenderBytes(content []byte, data map[string]any) ([]byte, error)

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

func (p *Provider) RenderText(content string, data map[string]any) (string, error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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