Documentation
¶
Index ¶
- Constants
- type Renderer
- func (r *Renderer) Error(w http.ResponseWriter, status int, message string, details error)
- func (r *Renderer) GetLogOutput() io.Writer
- func (r *Renderer) GetStaticDirectoryPath() string
- func (r *Renderer) GetTemplateDirectoryPath() string
- func (r *Renderer) JSON(w http.ResponseWriter, status int, v interface{})
- func (r *Renderer) Status(w http.ResponseWriter, status int)
- type TemplateInterface
- type Templates
Constants ¶
View Source
const (
// BaseTemplatePath is the base template.
BaseTemplatePath = "web/template/base.html.tmpl"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Renderer ¶
type Renderer struct {
// the compiled templates
Template TemplateInterface
// contains filtered or unexported fields
}
Renderer is the renderer.
func NewRenderer ¶
func NewRenderer(envConfig *config.Environment, t TemplateInterface) *Renderer
NewRenderer creates a new renderer.
func (*Renderer) GetLogOutput ¶
GetLogOutput returns the log output.
func (*Renderer) GetStaticDirectoryPath ¶
GetStaticDirectoryPath returns the static directory path.
func (*Renderer) GetTemplateDirectoryPath ¶
GetTemplateDirectoryPath returns the template directory path.
type TemplateInterface ¶
type TemplateInterface interface {
SetBaseTemplate(baseTemplate string)
AddTemplate(name string, files []string)
RenderTemplate(w http.ResponseWriter, name string, data interface{}) error
}
TemplateInterface is an interface for Templates.
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
Templates is a struct that holds the templates that we want to use.
func (*Templates) AddTemplate ¶
AddTemplate adds the templates to the Templates struct.
func (*Templates) RenderTemplate ¶
func (t *Templates) RenderTemplate(w http.ResponseWriter, name string, data interface{}) error
RenderTemplate renders the template.
func (*Templates) SetBaseTemplate ¶
SetBaseTemplate sets the base template.
Click to show internal directories.
Click to hide internal directories.