template

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTemplateName

func CheckTemplateName(name string) error

CheckTemplateName validates the name of the template.

Types

type FileNotFoundError

type FileNotFoundError struct {
	TemplateFileName string
	Err              error
}

FileNotFoundError is the error returned when a template file is missing.

func (FileNotFoundError) Error

func (t FileNotFoundError) Error() string

Error returns the string error msg for FileNotFoundError.

type RegistrationRequest

type RegistrationRequest struct {
	Name            string `json:"name"                  mapstructure:"name"`
	Handler         string `json:"handler"               mapstructure:"handler"`
	BodyTmplPath    string `json:"body_template_path"    mapstructure:"body_template_path"`
	SubjectTmplPath string `json:"subject_template_path" mapstructure:"subject_template_path"`
	Persistent      bool   `json:"persistent"            mapstructure:"persistent"`
}

RegistrationRequest represents a Template registration request.

type Template

type Template struct {
	Name       string
	Handler    handler.Handler
	Persistent bool
	// contains filtered or unexported fields
}

Template represents a notification template.

func New

func New(m map[string]interface{}, hs map[string]handler.Handler) (*Template, string, error)

New creates a new Template from a RegistrationRequest.

func (*Template) RenderBody

func (t *Template) RenderBody(arguments map[string]interface{}) (string, error)

RenderBody renders the body template.

func (*Template) RenderSubject

func (t *Template) RenderSubject(arguments map[string]interface{}) (string, error)

RenderSubject renders the subject template.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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