template

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Zlib Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONEscape

func JSONEscape(v interface{}) string

func TimeCurrent

func TimeCurrent() int64

Types

type Command

type Command func(source interface{}, d D, handler Handler) error

func Chain

func Chain(handlers ...Command) Command

type Content

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

type ContentMap

type ContentMap map[string]Content

type D

type D map[string]interface{}

type Data

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

func (*Data) Bytes

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

func (*Data) Write

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

type Delims

type Delims struct {
	Left  string
	Right string
}

type Engine

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

func DefEngine

func DefEngine() *Engine

func NewEngine

func NewEngine(delims Delims) *Engine

func (*Engine) LoadFiles

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

func (*Engine) LoadGlob

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

func (*Engine) OUTPUT

func (cr *Engine) OUTPUT(name string, d D) (*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 Command)

func (*Format) Format

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

func (*Format) Load

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

func (*Format) LoadTemplate

func (ft *Format) LoadTemplate(path string)

type Handler

type Handler func(source interface{}, d D) 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
}

Jump to

Keyboard shortcuts

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