Documentation
¶
Overview ¶
Package template provides notification template rendering using Go text/template with Sprig function library support.
Index ¶
- func Init() error
- type Engine
- func (e *Engine) GetTemplateID(eventType string) string
- func (e *Engine) HasTemplate(id string) bool
- func (e *Engine) ListTemplateIDs() []string
- func (e *Engine) LoadConfig(templates []config.NotifyTemplate) error
- func (e *Engine) Render(templateID, channel string, data map[string]any) (*RenderResult, error)
- type RenderResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine renders notification templates for different channels using Sprig functions.
func (*Engine) GetTemplateID ¶
GetTemplateID returns the template ID for a given event type. This is a convenience mapping that can be extended.
func (*Engine) HasTemplate ¶
HasTemplate returns true if the given template ID exists in the engine.
func (*Engine) ListTemplateIDs ¶
ListTemplateIDs returns all registered template IDs in the engine.
func (*Engine) LoadConfig ¶
func (e *Engine) LoadConfig(templates []config.NotifyTemplate) error
LoadConfig loads templates from notify configuration and compiles all templates.
type RenderResult ¶
RenderResult holds the output of template rendering for a specific channel.
Click to show internal directories.
Click to hide internal directories.