templates

package
v0.0.0-...-978c921 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT, CC-BY-4.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateNotFound = fmt.Errorf("template not found")

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Name      string
	ContentID string
	Content   []byte
}

type Email

type Email struct {
	Header      textproto.MIMEHeader
	Text        []byte
	HTML        []byte
	Attachments []Attachment
}

func EvaluateEmail

func EvaluateEmail(t *Templater, baseName string, context interface{}) (*Email, error)

func (*Email) WriteTo

func (e *Email) WriteTo(w io.Writer) (int64, error)

type StaticFiles

type StaticFiles struct {
	// contains filtered or unexported fields
}

func (*StaticFiles) Attachments

func (sf *StaticFiles) Attachments() map[string]Attachment

func (*StaticFiles) File

func (sf *StaticFiles) File(path string) (template.URL, error)

func (*StaticFiles) ResetAttachments

func (sf *StaticFiles) ResetAttachments()

type TemplateTest

type TemplateTest struct {
	Data interface{}
}

type Templater

type Templater struct {
	Templates map[string]*template.Template
	// contains filtered or unexported fields
}

func (*Templater) Evaluate

func (t *Templater) Evaluate(name string, context interface{}) ([]byte, error)

func (*Templater) Load

func (t *Templater) Load(path string) []error

func (*Templater) Validate

func (t *Templater) Validate(name string, testCase ...TemplateTest) []error

Jump to

Keyboard shortcuts

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