template

package
v1.22.21 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Zlib Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape added in v1.20.87

func Escape(v interface{}) string

func JSONMarshal added in v1.20.87

func JSONMarshal(v interface{}) string

func Replace added in v1.20.87

func Replace(filename string, tempConfing any) (io.Reader, error)

func ReplaceV2 added in v1.20.87

func ReplaceV2(filename string, tempConfing any, engFn func(engine *Engine)) ([]byte, error)

func TimeCurrent

func TimeCurrent() int64

func Trim added in v1.20.87

func Trim(v interface{}) string

Types

type CommandFunc added in v1.2.23

type CommandFunc func(source interface{}, opt *Option, handler HandlerFunc) error

func Chain

func Chain(handlers ...CommandFunc) CommandFunc

type Content

type Content struct {
	Name string `json:"name"`
	Func string `json:"func"`
}

type ContentMap

type ContentMap map[string]Content

type Data

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

func (*Data) Bytes

func (d *Data) Bytes() []byte

func (*Data) Read added in v1.6.13

func (d *Data) Read(p []byte) (n int, err error)

Reader interface

func (*Data) Write

func (d *Data) Write(p []byte) (n int, err error)

Writer interface

type Delims

type Delims struct {
	Left  string
	Right string
}

type Engine

type Engine struct {
	Delims Delims
	// contains filtered or unexported fields
}

func DefEngine

func DefEngine() *Engine

func NewEngine

func NewEngine(delims Delims) *Engine

func (*Engine) AddFunc added in v1.2.23

func (cr *Engine) AddFunc(key string, value any) *Engine

func (*Engine) DelFunc added in v1.2.23

func (cr *Engine) DelFunc(key string) *Engine

func (*Engine) LoadFS added in v1.2.23

func (cr *Engine) LoadFS(obj fs.FS, patterns ...string) *Engine

func (*Engine) LoadFiles

func (cr *Engine) LoadFiles(files ...string) *Engine

func (*Engine) LoadGlob

func (cr *Engine) LoadGlob(pattern string) *Engine

func (*Engine) LoadString added in v1.2.23

func (cr *Engine) LoadString(str string) *Engine

func (*Engine) OUTPUT

func (cr *Engine) OUTPUT(name string, d interface{}) (*Data, error)

type Format

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

func DefFormat

func DefFormat() *Format

func NewFormat

func NewFormat(engine *Engine) *Format

func (*Format) AddCommand

func (ft *Format) AddCommand(funcName string, funcCall CommandFunc)

func (*Format) Format

func (ft *Format) Format(format, appId, filter string, source interface{}, handler HandlerFunc) (*Data, error)

func (*Format) FormatWith added in v1.2.23

func (ft *Format) FormatWith(cmdFn CommandFunc, tplName string, source interface{}, handler HandlerFunc) (*Data, error)

func (*Format) Load

func (ft *Format) Load(path string) error

func (*Format) LoadFS added in v1.2.23

func (ft *Format) LoadFS(f fs.FS, patterns ...string)

func (*Format) LoadString added in v1.2.23

func (ft *Format) LoadString(str string)

func (*Format) LoadTemplate

func (ft *Format) LoadTemplate(path string)

type HandlerFunc added in v1.2.23

type HandlerFunc func(source interface{}, opt *Option) error

type Item

type Item struct {
	Xml  ContentMap `json:"xml"`
	Json ContentMap `json:"json"`
}

type Items

type Items struct {
	ItMap map[string]Item `json:"items"` //[appid]Item
}

type Option added in v1.2.27

type Option struct {
	Data map[string]interface{}
}

Jump to

Keyboard shortcuts

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