view

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ViewPath   string `toml:"view_dir"`
	ViewSuffix string `toml:"view_suffix"`
	// contains filtered or unexported fields
}

type Template

type Template struct {
	Data map[string]interface{}
	// contains filtered or unexported fields
}

func New

func New(tnames ...string) (t Template)

新建一个模板

func (*Template) AddFile added in v0.1.2

func (t *Template) AddFile(n string)

设定模板路径

func (*Template) AddFileFull added in v0.1.2

func (t *Template) AddFileFull(file string)

设定全路径模板位置,不会自动增加前缀、后缀

func (*Template) AddFiles added in v0.1.2

func (t *Template) AddFiles(n ...string)

批量设定模板路径

func (*Template) AddFunc added in v0.1.2

func (t *Template) AddFunc(n string, f interface{})

添加模板函数

func (*Template) Assign added in v0.1.2

func (t *Template) Assign(name string, data interface{})

模板变量赋值

func (*Template) Fetch

func (t *Template) Fetch(w http.ResponseWriter) (err error)

渲染输出

func (*Template) SetAssign added in v0.1.2

func (t *Template) SetAssign(d map[string]interface{})

设置全部模板变量

Jump to

Keyboard shortcuts

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