template

package
v0.0.0-...-fbd1cd9 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 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 EmailRenderStrategy

type EmailRenderStrategy struct {
}

func NewEmailRenderStrategy

func NewEmailRenderStrategy() *EmailRenderStrategy

func (*EmailRenderStrategy) Render

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

type NotifyRenderStrategy

type NotifyRenderStrategy struct {
}

func NewNotifyRenderer

func NewNotifyRenderer() *NotifyRenderStrategy

func (*NotifyRenderStrategy) Render

func (r *NotifyRenderStrategy) 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