templates

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncMap

func FuncMap() template.FuncMap

FuncMap returns a set of custom template functions for use in notifications.

Types

type StringTemplate

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

StringTemplate wraps a parsed text template for string output.

func LoadString

func LoadString(path string) (*StringTemplate, error)

LoadString reads a file and parses it into a StringTemplate.

func LoadStringFromFS

func LoadStringFromFS(tmplFS fs.FS, path string) (*StringTemplate, error)

LoadStringFromFS reads a file from an fs.FS into a StringTemplate.

func ParseStringTemplate

func ParseStringTemplate(name, input string) (*StringTemplate, error)

ParseStringTemplate parses a string template with missingkey=error.

func (*StringTemplate) Render

func (t *StringTemplate) Render(data any) (string, error)

Render executes the template with the provided data and returns a string.

type Template

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

Template wraps a parsed text template loaded from disk.

func Load

func Load(path string) (*Template, error)

Load reads and parses a template file.

func LoadDefault

func LoadDefault(tmplFS fs.FS) (*Template, error)

LoadDefault parses the embedded heartbeat template.

func LoadFromFS

func LoadFromFS(tmplFS fs.FS, path string) (*Template, error)

LoadFromFS reads and parses a template from an fs.FS.

func (*Template) Render

func (t *Template) Render(data any) ([]byte, error)

Render executes the template with the provided data and returns the bytes.

Jump to

Keyboard shortcuts

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