Documentation ¶
Index ¶
- Constants
- func CloseWatcher() error
- func Html(name, contentType, charSet string) template
- func InitHtmlTemplates(pattern string) (err error)
- func InitTextTemplates(pattern string) (err error)
- func InitWatcher(pattern string, f func(string) error, ef func(error)) (err error)
- func Json(charSet string) json
- func PreloadFile(filename string, contentType string) (preloadFile, error)
- func Simple(contentType, charSet string) simple
- func StaticFile(filename string, contentType string) staticFile
- func Text(name, contentType, charSet string) template
- type View
Constants ¶
const ( ContentTypeJSON = "application/json" ContentTypeHTML = "text/html" ContentTypePlain = "text/plain" ContentTypeBinary = "application/octet-stream" CharSetUTF8 = "utf-8" )
Variables ¶
This section is empty.
Functions ¶
func Html ¶
func Html(name, contentType, charSet string) template
Html retruns a TemplateView witch uses HTML templates internally.
func InitHtmlTemplates ¶
InitHtmlTemplates initialzes a series of HTML templates in the directory `pattern`.
func InitTextTemplates ¶
InitTextTemplates initialzes a series of plain text templates in the directory `pattern`.
func InitWatcher ¶
InitWatcher initialzes a watcher to watch templates changes in the `pattern`. f would be InitHtmlTemplates or InitTextTemplates. If the watcher raises an error internally, the callback function ef will be executed. ef can be nil witch represents ignoring all internal errors.
func PreloadFile ¶
PreloadFile returns the view which can preload static files and serve them. The different between `StaticFile` and `PreloadFile` is that `StaticFile` load the content of file at every request, while `PreloadFile` load the content into memory at the initial stage. Despite that `PreloadFile` will be using more memories and could not update the content in time until restart the application, it should be fast than `StaticFile` in runtime.
func StaticFile ¶
StaticFile returns the view which can serve static files.