tmplstorage

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

tmplstorage implements filesystem templates storage with caching features

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCacheGCInterval = 60                                 //seconds
	DefaultTmplCacheTTL    = time.Second * time.Duration(86400) //seconds
	ERR_NOT_FOUND          = errors.New("template not found")
)

Functions

This section is empty.

Types

type TemplateStorage

type TemplateStorage struct {
	// contains filtered or unexported fields
}

TemplateStorage load, caching and return the templates by their id

func New

func New(path string) *TemplateStorage

New create the instance of TemplateStorage with path pointed to fs root directory where templates are located

func (*TemplateStorage) Template

func (t *TemplateStorage) Template(id string) (*template.Template, error)

Template return the template.Template instance for template id or error. Id is a path relative to the storage's root. If id doesn't end with '.tmpl' suffix, it will be added If id is empty, "default.tmpl" will be used

Jump to

Keyboard shortcuts

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