template

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

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