template

package
v0.0.0-...-a78f517 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTemplateLoader

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

func (*DefaultTemplateLoader) Load

func (l *DefaultTemplateLoader) Load(tplType RenderType) string

type EmailRender

type EmailRender struct {
}

func NewEmailRenderer

func NewEmailRenderer() *EmailRender

func (*EmailRender) Render

func (r *EmailRender) Render(tpl string, p tplParams, notify *entity.Notify, extra notifyExtraData) string

type NotifyRender

type NotifyRender struct {
}

func NewNotifyRenderer

func NewNotifyRenderer() *NotifyRender

func (*NotifyRender) Render

func (r *NotifyRender) Render(tpl string, p tplParams, notify *entity.Notify, extra notifyExtraData) string

type RenderStrategy

type RenderStrategy interface {
	Render(tpl string, p tplParams, notify *entity.Notify, extra notifyExtraData) string
}

type RenderType

type RenderType string
const (
	TYPE_EMAIL  RenderType = "email"
	TYPE_NOTIFY RenderType = "notify"
)

type Renderer

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

func NewRenderer

func NewRenderer(dao *dao.Dao, renderType RenderType, defaultTemplateLoader TemplateLoader) *Renderer

func (*Renderer) Render

func (r *Renderer) Render(notify *entity.Notify, customTpl ...string) string

type TemplateLoader

type TemplateLoader interface {
	Load(tplType RenderType) string
}

func NewFileLoader

func NewFileLoader(tplName string) TemplateLoader

Creates a new default template loader

tplName parameter is the template name, if tplName is empty, it will load the default template, or you can specify a custom template name. it will load the template from internal or external, first look up external, then internal.

Jump to

Keyboard shortcuts

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