template

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTemplates

func GetTemplates(dir string) []string

Types

type Template

type Template struct {
	TemplateName string
	Template     *template.Template
	AllTemplates []string
	Writer       http.ResponseWriter
}

Template handles the output of the server front template

func New

func New(templateName string, templates []string, writer http.ResponseWriter) *Template

NewTemplate returns a prepared template for handling a front end call

func (*Template) Run

func (f *Template) Run(data any)

Run generates a new template (as .TemplateName) adds in the functions from functionMap and includes AllTemplates to be parsed.

The template will then be executed and the result written in to the http.ResponseWriter with a status header and content type values set

Jump to

Keyboard shortcuts

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