godef

package
v0.0.0-...-834dad9 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTMLTemplate

type HTMLTemplate = Template[*htmltemplate.Template]

func NewHTMLTemplate

func NewHTMLTemplate(name, subject, content string, opts ...Option[*htmltemplate.Template]) (*HTMLTemplate, error)

NewHTMLTemplate returns new template

type Option

type Option[TMPL itmpl] func(*Template[TMPL])

func WithHTMLPreRender

func WithHTMLPreRender(preRender preRenderFunc) Option[*htmltemplate.Template]

func WithHTMLVars

func WithHTMLVars(vars map[string]any) Option[*htmltemplate.Template]

func WithPreRender

func WithPreRender[TMPL itmpl](preRender preRenderFunc) Option[TMPL]

func WithTextPreRender

func WithTextPreRender(preRender preRenderFunc) Option[*texttemplate.Template]

func WithTextVars

func WithTextVars(vars map[string]any) Option[*texttemplate.Template]

func WithVars

func WithVars[TMPL itmpl](vars map[string]any) Option[TMPL]

type Template

type Template[TMPL itmpl] struct {
	// contains filtered or unexported fields
}

Template is the template for the message

func (*Template[TMPL]) IsHTML

func (t *Template[TMPL]) IsHTML() bool

IsHTML returns true if the template is HTML

func (*Template[TMPL]) Name

func (t *Template[TMPL]) Name() string

Name returns the name of the template

func (*Template[TMPL]) Render

func (t *Template[TMPL]) Render(ctx context.Context, wr io.Writer, params map[string]any) error

Render renders the template with the given params

func (*Template[TMPL]) Subject

func (t *Template[TMPL]) Subject(ctx context.Context, vars map[string]any) (string, error)

Subject returns the subject of the template

type TextTemplate

type TextTemplate = Template[*texttemplate.Template]

func NewTextTemplate

func NewTextTemplate(name, subject, content string, opts ...Option[*texttemplate.Template]) (*TextTemplate, error)

NewTextTemplate returns new template

Jump to

Keyboard shortcuts

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