templating

package
v0.0.4-28 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTemplateFunc

func AddTemplateFunc(tmplStr string, funcName string) (string, error)

Add template func to each variable

func CreateTemplateWithFunc

func CreateTemplateWithFunc(name string, funcMap template.FuncMap) *template.Template

Create new template with funcMap

func ParseTemplate

func ParseTemplate(templt *template.Template, tmplStr string, variables any) (string, error)

Parse template

func RenderJSON

func RenderJSON(data map[string]any, variables map[string]any) (map[string]any, error)

Render json template

func RenderNormalizedTemplate

func RenderNormalizedTemplate(name string, tmplStr string, variables any) (string, error)

Create template with funcMap and apply func to all variables

func RenderTemplate

func RenderTemplate(name string, tmplStr string, variables any) (string, error)

Create new template and parse it

func TransformTemplateKeys

func TransformTemplateKeys(tmplStr string, prefix string, transform func(varRegex *regexp.Regexp, m string) string) (string, error)

transform template variables with func

Types

This section is empty.

Jump to

Keyboard shortcuts

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