driver

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: Apache-2.0 Imports: 3 Imported by: 47

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	//初始化模板引擎
	Init(...bool)

	//获取模板根路径
	TmplDir() string
	SetLogger(logger.Logger)
	Logger() logger.Logger

	//设置模板内容预处理器
	SetContentProcessor(fn func([]byte) []byte)
	SetManager(Manager)

	//设置模板函数
	SetFuncMap(func() map[string]interface{})

	//渲染模板
	Render(io.Writer, string, interface{}, echo.Context) error

	//获取模板渲染后的结果
	Fetch(string, interface{}, map[string]interface{}) string

	//读取模板原始内容
	RawContent(string) ([]byte, error)

	//模板目录监控事件
	MonitorEvent(func(string))

	//清除模板对象缓存
	ClearCache()

	//关闭并停用模板引擎
	Close()
}

type Manager added in v1.1.0

type Manager interface {
	Close()
	SetOnChangeCallback(func(name, typ, event string))
	SetLogger(logger.Logger)
	ClearCache()
	GetTemplate(string) ([]byte, error)
	Init(logger logger.Logger, rootDir string, reload bool, allows ...string)
}

type NopRenderer added in v1.1.0

type NopRenderer struct{}

func (*NopRenderer) ClearCache added in v1.1.0

func (n *NopRenderer) ClearCache()

func (*NopRenderer) Close added in v1.1.0

func (n *NopRenderer) Close()

func (*NopRenderer) Fetch added in v1.1.0

func (n *NopRenderer) Fetch(_ string, _ interface{}, _ map[string]interface{}) string

func (*NopRenderer) Init added in v1.1.0

func (n *NopRenderer) Init(_ ...bool)

func (*NopRenderer) Logger added in v1.1.0

func (n *NopRenderer) Logger() logger.Logger

func (*NopRenderer) MonitorEvent added in v1.1.0

func (n *NopRenderer) MonitorEvent(_ func(string))

func (*NopRenderer) RawContent added in v1.1.0

func (n *NopRenderer) RawContent(_ string) ([]byte, error)

func (*NopRenderer) Render added in v1.1.0

func (n *NopRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

func (*NopRenderer) SetContentProcessor added in v1.1.0

func (n *NopRenderer) SetContentProcessor(fn func([]byte) []byte)

func (*NopRenderer) SetFuncMap added in v1.1.0

func (n *NopRenderer) SetFuncMap(_ func() map[string]interface{})

func (*NopRenderer) SetLogger added in v1.1.0

func (n *NopRenderer) SetLogger(_ logger.Logger)

func (*NopRenderer) SetManager added in v1.1.0

func (n *NopRenderer) SetManager(_ Manager)

func (*NopRenderer) TmplDir added in v1.1.0

func (n *NopRenderer) TmplDir() string

Jump to

Keyboard shortcuts

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