templates

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: MIT Imports: 11 Imported by: 0

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

Get returns template with passed path. It panics, if template doesn't exist

Jump to

Keyboard shortcuts

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