vweb_dynamic

package module
v0.0.0-...-1f2d283 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFunc = template.FuncMap{}/* 111 elements not displayed */

模板函数映射

Functions

func ExtendPackage

func ExtendPackage(name string, deputy template.FuncMap)

ExtendPackage 扩展模板的包

name string				包名
deputy map[string]any 	函数集

Types

type Igop

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

func (*Igop) Execute

func (T *Igop) Execute(out io.Writer, in interface{}) (err error)

func (*Igop) Parse

func (T *Igop) Parse(r io.Reader) (err error)

func (*Igop) ParseFile

func (T *Igop) ParseFile(path string) error

func (*Igop) ParseText

func (T *Igop) ParseText(name, content string) error

func (*Igop) SetEntryName

func (T *Igop) SetEntryName(name string)

func (*Igop) SetPath

func (T *Igop) SetPath(root, page string)

type Template

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

Template 模本-处理动态页面文件

func (*Template) Execute

func (T *Template) Execute(out io.Writer, in interface{}) error

func (*Template) Parse

func (T *Template) Parse(r io.Reader) error

func (*Template) ParseFile

func (T *Template) ParseFile(path string) error

func (*Template) ParseText

func (T *Template) ParseText(name, content string) error

func (*Template) SetEntryName

func (T *Template) SetEntryName(name string)

func (*Template) SetPath

func (T *Template) SetPath(root, page string)

type TemplateExtend

type TemplateExtend struct {
	*template.Template
}

这是个额外扩展,由于模板不能实现函数创建,只能在这里构造一个支持创建函数。 在创建的函数内部,需要使用 Args 方法读取参数,使用 Result 方法返回结果。 仅限用于template模板,自定义模板不支持

func (*TemplateExtend) Call

func (T *TemplateExtend) Call(f func([]reflect.Value) []reflect.Value, args ...interface{}) []interface{}

Call 执行函数

f func([]reflect.Value) []reflect.Value	由NewFunc创建的函数
args ...interface{}						可变参数
[]interface{}							返回结果

func (*TemplateExtend) ExecuteTemplate

func (T *TemplateExtend) ExecuteTemplate(out io.Writer, name string, in interface{}) error

ExecuteTemplate 调用模板

out io.Writer	模板内容返回内容写入到out
name string		模板名称
in interface{}	模板点,带外模板的内容
error			执行语法错误

func (*TemplateExtend) NewFunc

func (T *TemplateExtend) NewFunc(name string) (f func([]reflect.Value) []reflect.Value, err error)

NewFunc 构建一个新的函数,仅限在template中使用

func([]reflect.Value) []reflect.Value)	新的函数

type TemplateHeader

type TemplateHeader struct {
	File                  []string // 文件路径, map[文件名或别名]文件路径
	DelimLeft, DelimRight string   // 语法识别符
}

标头-模本-处理动态页面文件

func (*TemplateHeader) OpenFile

func (T *TemplateHeader) OpenFile(rootPath, pagePath string) (map[string]string, error)

打开文件内容

rootPath  string    	根目录
pagePath  string		页面路径
map[string][]byte   内容,map[文件名]文件内容
error               错误,如果文件不能打开读取

type Yaegi

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

func (*Yaegi) Execute

func (T *Yaegi) Execute(out io.Writer, in interface{}) (err error)

func (*Yaegi) Parse

func (T *Yaegi) Parse(r io.Reader) (err error)

func (*Yaegi) ParseFile

func (T *Yaegi) ParseFile(p string) error

func (*Yaegi) ParseText

func (T *Yaegi) ParseText(name, content string) error

func (*Yaegi) SetEntryName

func (T *Yaegi) SetEntryName(name string)

func (*Yaegi) SetPath

func (T *Yaegi) SetPath(root, page string)

Jump to

Keyboard shortcuts

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