Documentation ¶
Overview ¶
Package templates provides a store for templates which supports caching
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TemplateStore ¶
type TemplateStore struct {
// contains filtered or unexported fields
}
TemplateStore is used for serving *template.Template. It provides in-memory template caching
func NewTemplateStore ¶
func NewTemplateStore(log logrus.FieldLogger, cacheTemplates bool) *TemplateStore
NewTemplateStore inits new Template Store
func (*TemplateStore) Execute ¶
func (t *TemplateStore) Execute(ctx context.Context, path string, w io.Writer, data interface{}) error
Execute executes template with passed path. It panics, if template doesn't exist Execute checks for errors before writing into w: it executes template into temporary buffer and copies data if everything is fine
func (*TemplateStore) Get ¶
func (t *TemplateStore) Get(ctx context.Context, path string) *htmlTemplate.Template
Get returns template with passed path. It panics, if template doesn't exist
Click to show internal directories.
Click to hide internal directories.