-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Consider about Feature to use pre-compiled template to reduce template parsing for higher performance for mass template usage with a bit different values i.e.
type Template struct {
raw string
tokens []Token // pre-parsed tokens
}
// Compile parses template single time
func Compile(template string) (*Template, error) {
tokens, err := parse(template)
if err != nil {
return nil, err
}
return &Template{raw: template, tokens: tokens}, nil
}
func MustCompile(template string) *Template {
tmpl, err := Compile(template)
if err != nil {
panic(err)
}
return tmpl
}
// Methods
func (t *Template) Format(args ...any) string
func (t *Template) FormatComplex(args map[string]any) stringThis can be either new methods that uses compilation or toy could modify existing ones
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels