Documentation
¶
Index ¶
- func AddFuncMap(key string, fn interface{}) error
- func AddTemplateExt(ext string)
- func AssetsCSS(text string) template.HTML
- func AssetsJs(text string) template.HTML
- func BuildTemplate(dir string, files ...string) error
- func DateFormat(t time.Time) string
- func DateTimeFormat(t time.Time, format string) string
- func ExecuteTemplate(wr io.Writer, name, viewPath string, runMode string, data interface{}) error
- func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, runMode string, data interface{}) error
- func HTML2str(html string) string
- func HasTemplateExt(paths string) bool
- func InSlice(v string, sl []string) bool
- func IntDateFormat(val int64) (ret string)
- func IntDateTime(val int64) (ret string)
- func IntDateTimeFormat(val int64, format string) (ret string)
- func SetTemplateFSFunc(fnt templateFSFunc)
- func Str2HTML(str string) template.HTML
- func Substr(s string, start, length int) string
- func TimeFormat(t time.Time) string
- func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error
- type Delims
- type FileSystem
- type HTMLRender
- type Render
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFuncMap ¶
AddFuncMap let user to register a func in the template.
func AddTemplateExt ¶
func AddTemplateExt(ext string)
AddTemplateExt add new extension for template.
func BuildTemplate ¶
BuildTemplate will build all template files in a directory. it makes beego can render any template file in view directory.
func DateTimeFormat ¶
DateTimeFormat time.Time to format datetime
format = "YYYY-MM-DD HH:mm:ss" or "YYYY年MM月DD日"
func ExecuteTemplate ¶
ExecuteTemplate applies the template with name to the specified data object, writing the output to wr. A template will be executed safely in parallel.
func ExecuteViewPathTemplate ¶
func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, runMode string, data interface{}) error
ExecuteViewPathTemplate applies the template with name and from specific viewPath to the specified data object, writing the output to wr. A template will be executed safely in parallel.
func HasTemplateExt ¶
HasTemplateExt return this path contains supported template extension of beego or not.
func IntDateFormat ¶
IntDateFormat int timestamp to date format
func IntDateTimeFormat ¶
IntDateTimeFormat return datetime string format ="YYYY-MM-DD HH:mm:ss" or format ="YYYY-MM-DD HH:mm"
func SetTemplateFSFunc ¶
func SetTemplateFSFunc(fnt templateFSFunc)
SetTemplateFSFunc set default filesystem function
Types ¶
type FileSystem ¶
type FileSystem struct{}
type HTMLRender ¶
type HTMLRender struct { ViewPath string Name string AutoRender bool FuncMap template.FuncMap Data interface{} Delims Delims RunMode string }
HTMLRender a simple html render
func (HTMLRender) NewHTMLRender ¶
func (m HTMLRender) NewHTMLRender(dir string, funcMap template.FuncMap, delims Delims, autoRender bool, runMode string) Render
NewHTMLRender return a Render interface
func (HTMLRender) Render ¶
func (m HTMLRender) Render(w http.ResponseWriter, name string, data interface{}) error
Render render implement
func (HTMLRender) WriteContentType ¶
func (m HTMLRender) WriteContentType(w http.ResponseWriter)
WriteContentType implement
type Render ¶
type Render interface { Render(w http.ResponseWriter, name string, data interface{}) error WriteContentType(w http.ResponseWriter) }
Render interface is to be implemented by HTML