Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DevMode ¶
func DevMode()
DevMode changes the template behavior to include error details. This is the default behavior.
func ProductionMode ¶
func ProductionMode()
ProductionMode makes the template behavior panic only when there is an error. This is equivalent to calling template.Must(...
Types ¶
type DevModeRenderer ¶
type DevModeRenderer struct {
// contains filtered or unexported fields
}
DevModeRenderer is responsible for rendering templates and when an error occurs will output the error details
func (*DevModeRenderer) RenderHTML ¶
func (r *DevModeRenderer) RenderHTML(wr http.ResponseWriter, data interface{})
RenderHTML will render an html/template or in the case of an error will display an errorpage with the error details.
type ParseError ¶
ParseError is details the error template uses to render the error page
func (*ParseError) SourceLines ¶
func (p *ParseError) SourceLines() []*SourceLine
SourceLines will parse out the error details of a template error.
type ProductionRenderer ¶
type ProductionRenderer struct {
// contains filtered or unexported fields
}
ProductionRenderer is responsible for only rendering the template and will panic in the occurrence of an error. This is equivalent to template.Must(...
func (*ProductionRenderer) RenderHTML ¶
func (r *ProductionRenderer) RenderHTML(wr http.ResponseWriter, data interface{})
RenderHTML will render an html/template file and panic if there is an error
type Renderer ¶
type Renderer interface {
RenderHTML(wr http.ResponseWriter, data interface{})
}
Renderer is the template rendering interface
type SourceLine ¶
SourceLine is the detail about a single line in a template file used for rendering the error page.
type TemplateBuilder ¶
type TemplateBuilder struct {
// contains filtered or unexported fields
}
TemplateBuilder is responsible for building the collection of template files.
func TemplateFiles ¶
func TemplateFiles(filenames ...string) *TemplateBuilder
TemplateFiles is the list of file paths relative from the callers code file.
func (*TemplateBuilder) Template ¶
func (v *TemplateBuilder) Template() Renderer
Template will return the Dev or Production Renderer implementation based on current settings