temfhttp

package
v0.0.0-...-0c1db29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 PreloadTemplate

func PreloadTemplate(name string, r io.Reader) (string, error)

func PreloadTemplateFile

func PreloadTemplateFile(templateName string) (string, error)

PreloadTemplateFile updates the definition of a single template file into memory.

func PreloadTemplateInMemory

func PreloadTemplateInMemory(name string, r io.Reader, o *combiner.Options) error

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 Render

func Render(c *fasthttp.RequestCtx, tmpl string, p map[string]interface{})

func RenderWithStatus

func RenderWithStatus(c *fasthttp.RequestCtx, templateName string, p map[string]interface{}, status int)

func Save

func Save()

Save is used to push in-memory templates to the Go template engine

Types

type FasthttpHandler

type FasthttpHandler func(ctx *fasthttp.RequestCtx, p map[string]interface{}) map[string]interface{}

type Plugin

type Plugin interface {
	Name() string
	Enabled() bool
	TemplateDir() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL