translate

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data, codec string) (any, error)

Decode decodes the raw, yaml/json, toml and returns the result.

func Execute

func Execute(v any, tmp TemplateExecuter) ([]byte, error)

Execute executes the template with the given data.

func SetGlobalTemplate

func SetGlobalTemplate(t *Template)

Types

type Template

type Template struct {
	TXT  *textTemplate.Template
	HTML *htmlTemplate.Template
}
var GlobalTemplate *Template

func NewTemplate

func NewTemplate() *Template

func (Template) Ext

func (t Template) Ext(value any, templateValue string, templateType Tmp, funcList []string) ([]byte, error)

type TemplateExecuter

type TemplateExecuter interface {
	Execute(wr io.Writer, data interface{}) error
}

type Tmp

type Tmp int
const (
	TXT Tmp = iota
	HTML
)

Jump to

Keyboard shortcuts

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