Documentation ¶
Index ¶
- Variables
- func Preload()
- func PreloadInMemory()
- func PreloadPlugins()
- func PreloadTemplate(name string, r io.Reader) (string, error)
- func PreloadTemplateFile(templateName string) (string, error)
- func PreloadTemplateInMemory(name string, r io.Reader, o *combiner.Options) error
- func Register(templateName string)
- func RegisterHandler(h FasthttpHandler)
- func RegisterPlugin(p Plugin)
- func Render(c *fasthttp.RequestCtx, tmpl string, p map[string]interface{})
- func RenderWithStatus(c *fasthttp.RequestCtx, templateName string, p map[string]interface{}, ...)
- func Save()
- type FasthttpHandler
- type Plugin
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Directory is the folder in which the template files are expected to be Directory = "templates" // Minify indicates whether or not the resulting HTML pages should be minified by using Minify = false // NoCache indicates whether or not we should add the Cache-Control header "no-cache" NoCache = true )
View Source
var Plugins []Plugin
View Source
var Router = fasthttprouter.New()
Functions ¶
func Preload ¶
func Preload()
Preload loads all the previously registered templates (see `Register`) into memory, to be used by `Render`.
func PreloadInMemory ¶
func PreloadInMemory()
PreloadInMemory loads the internal representation of the different templates, but does not 'register' it with the Go templating engine
func PreloadPlugins ¶
func PreloadPlugins()
PreloadPlugins 'extends' / 'overwrites' any existing plugins with those defined in the plugins
func PreloadTemplateFile ¶
PreloadTemplateFile updates the definition of a single template file into memory.
func PreloadTemplateInMemory ¶
func Register ¶
func Register(templateName string)
Register adds the given `templateName` to the list of files that need to be loaded on `Preload`
It is by no means thread-safe.
func RegisterHandler ¶
func RegisterHandler(h FasthttpHandler)
func RegisterPlugin ¶
func RegisterPlugin(p Plugin)
RegisterPlugin lists the `Plugin` for preloading
func RenderWithStatus ¶
func RenderWithStatus(c *fasthttp.RequestCtx, templateName string, p map[string]interface{}, status int)
Types ¶
type FasthttpHandler ¶
type FasthttpHandler func(ctx *fasthttp.RequestCtx, p map[string]interface{}) map[string]interface{}
Click to show internal directories.
Click to hide internal directories.