elt

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(template string, data any, strict ...bool) (string, error)

Evaluate parse and apply the template to the specified data object, and returns the evaluated string.

func Execute

func Execute(w io.Writer, template string, data any, strict ...bool) error

Execute applies a parsed template to the specified data object, and writes the output to w. If an error occurs executing the template or writing its output, execution stops, but partial results may already have been written to the output writer. A template may be executed safely in parallel, although if parallel executions share a Writer the output may be interleaved.

Types

type ELTemplate

type ELTemplate struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(template string, delims ...string) (*ELTemplate, error)

func (*ELTemplate) Evaluate

func (elt *ELTemplate) Evaluate(data any, strict ...bool) (string, error)

Evaluate applies a parsed template to the specified data object, and returns the evaluated string.

func (*ELTemplate) Execute

func (elt *ELTemplate) Execute(w io.Writer, data any, strict ...bool) error

Execute applies a parsed template to the specified data object, and writes the output to w. If an error occurs executing the template or writing its output, execution stops, but partial results may already have been written to the output writer. A template may be executed safely in parallel, although if parallel executions share a Writer the output may be interleaved.

func (*ELTemplate) String

func (elt *ELTemplate) String() string

Jump to

Keyboard shortcuts

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