Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ViewEngine ¶
type ViewEngine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(rootDir, ext string) (*ViewEngine, error)
NewEngine create a new view engine. rootDir: the root dir of the view files; ext: the view file extension(starts with "."), and the default file extension is '.gohtml';
func (*ViewEngine) AddFunc ¶
func (engine *ViewEngine) AddFunc(name string, viewFunc interface{})
AddFunc add new view func to the view files
func (*ViewEngine) Clear ¶
func (engine *ViewEngine) Clear()
Clear clear all the cache in the view engine. and re-compile the view files into memory at next call 'Render' or 'RenderStr'
func (*ViewEngine) Render ¶
func (engine *ViewEngine) Render(writer io.Writer, viewPath string, viewData interface{}) error
Render render the view file with given data and then write the result to an io writer. viewPath: the relative view file path that will be rendered. viewData: the view data writer: the given io writer
Click to show internal directories.
Click to hide internal directories.