template

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITplEngine

type ITplEngine interface {
	NewTemplate(string) *TplEngine
	Parse(string) *TplEngine
	ParseFiles(...string) *TplEngine
	AssignMap(map[string]interface{}) *TplEngine
	Assign(string, interface{}) *TplEngine
	Display(string)
	Response(int, interface{}, string)
	ResponseWithHeader(int, interface{}, string, map[string]string)
}

type ResponseData

type ResponseData struct {
	Code    int         `json:"code"`
	Result  interface{} `json:"result"`
	Message string      `json:"message"`
}

type TplEngine

type TplEngine struct {
	TplData map[string]interface{}
	W       http.ResponseWriter
	R       *http.Request
	Header  map[string]string
	// contains filtered or unexported fields
}

func NewTplEngine

func NewTplEngine(w http.ResponseWriter, r *http.Request) *TplEngine

func (*TplEngine) Assign

func (t *TplEngine) Assign(key string, data interface{}) *TplEngine

func (*TplEngine) AssignMap

func (t *TplEngine) AssignMap(data map[string]interface{}) *TplEngine

func (*TplEngine) Display

func (t *TplEngine) Display(tpl string)

func (*TplEngine) DisplayMulti

func (t *TplEngine) DisplayMulti(tpl string, subTpl []string)

func (*TplEngine) NewTemplate

func (t *TplEngine) NewTemplate(name string) *TplEngine

func (*TplEngine) Parse

func (t *TplEngine) Parse(content string) *TplEngine

func (*TplEngine) ParseFiles

func (t *TplEngine) ParseFiles(tplName ...string) *TplEngine

func (*TplEngine) Response

func (t *TplEngine) Response(code int, result interface{}, message string)

func (*TplEngine) ResponseWithHeader

func (t *TplEngine) ResponseWithHeader(code int, result interface{}, message string, headerOptions map[string]string)

Jump to

Keyboard shortcuts

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