render

package
v0.0.0-...-0cd45ec Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultData

func AddDefaultData(td *models.TemplateData, r *http.Request) *models.TemplateData

AddDefaultData creates default models.TemplateData which should be accessable to each template when rendered.

func CreateTemplateCache

func CreateTemplateCache() (map[string]*template.Template, error)

CreateTemplateCache creates a Template Cache map[string]*tempalte.Template{} which stores all application templates in memory and makes them easier to load; loading from internal memory is faster then loading from disk each time.

func HumanDate

func HumanDate(t time.Time) string

HumanDate returns time in YYYY-MM-DD format

func IsAvailable

func IsAvailable(name string, data interface{}) bool

IsAvailable checks whether or not struct field is available

func IsInt

func IsInt(i interface{}) bool

IsInt returns true if argument is of type int

func IsString

func IsString(i interface{}) bool

IsString returns true if argument is of type string

func NewRenderer

func NewRenderer(a *config.AppConfig)

NewRenderer sets the config for the template package

func Template

func Template(w http.ResponseWriter, r *http.Request, tmpl string, td *models.TemplateData) error

Template renders template using html/template package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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