templatecache

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTemplateNotFound  = errors.New("error template not found")
	ErrWalkingDir        = errors.New("error walking directory")
	ErrReadingContent    = errors.New("error reading template content")
	ErrParsingTemplate   = errors.New("error parsing template")
	ErrGettingTemplate   = errors.New("error getting template")
	ErrExecutingTemplate = errors.New("error executing template")
)

Functions

func ExecuteTemplate

func ExecuteTemplate(templatePath string, data any) (string, error)

ExecuteTemplate executes a cached template with the provided data.

func LoadTemplates

func LoadTemplates(templates embed.FS) (map[string][]byte, error)

LoadTemplates loads all embedded .gotmpl files into memory.

func PreloadTemplates

func PreloadTemplates(templates embed.FS, funcMap template.FuncMap) error

PreloadTemplates loads all embedded templates into the cache. It parses all templates together to support template composition.

Types

This section is empty.

Jump to

Keyboard shortcuts

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