Documentation ¶
Overview ¶
Package render support to render templates by your control.
Index ¶
- Constants
- type Config
- type Render
- func (render *Render) Asset(name string) ([]byte, error)
- func (render *Render) Execute(name string, context interface{}, request *http.Request, ...) error
- func (render *Render) Funcs(funcMap template.FuncMap) *Template
- func (render *Render) Layout(name string) *Template
- func (render *Render) PrependViewPath(paths ...string)
- func (render *Render) RegisterFuncMap(name string, fc interface{})
- func (render *Render) RegisterViewPath(paths ...string)
- func (render *Render) SetAssetFS(assetFS assetfs.Interface)
- type Template
Constants ¶
View Source
const DefaultLayout = "application"
DefaultLayout default layout name
View Source
const DefaultViewPath = "app/views"
DefaultViewPath default view path
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ViewPaths []string DefaultLayout string FuncMapMaker func(render *Render, request *http.Request, writer http.ResponseWriter) template.FuncMap AssetFileSystem assetfs.Interface }
Config render config
type Render ¶
type Render struct { *Config // contains filtered or unexported fields }
Render the render struct.
func (*Render) Execute ¶
func (render *Render) Execute(name string, context interface{}, request *http.Request, writer http.ResponseWriter) error
Execute render template with default "application" layout.
func (*Render) PrependViewPath ¶
PrependViewPath prepend view path
func (*Render) RegisterFuncMap ¶
RegisterFuncMap register FuncMap for render.
func (*Render) RegisterViewPath ¶
RegisterViewPath register view path
func (*Render) SetAssetFS ¶
SetAssetFS set asset fs for render
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template template struct
func (*Template) Execute ¶
func (tmpl *Template) Execute(templateName string, obj interface{}, req *http.Request, w http.ResponseWriter) error
Execute execute tmpl
Click to show internal directories.
Click to hide internal directories.