templates

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

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTemplateNotFound = errors.New("template was not found")
)

Functions

This section is empty.

Types

type HTMLTemplate

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

HTMLTemplate caches html templates

func New

func New(dir string, hotReload bool) (*HTMLTemplate, error)

New Creates a new HTMLTemplate cache

func (*HTMLTemplate) Render

func (htmlTs *HTMLTemplate) Render(w http.ResponseWriter, r *http.Request, templateName string, data any) error

Render renders HTML template and puts rendered HTML into response

func (*HTMLTemplate) RenderComponent

func (htmlTs *HTMLTemplate) RenderComponent(w http.ResponseWriter, r *http.Request, templateName string, data any) error

RenderComponent renders a partial HTML component

Jump to

Keyboard shortcuts

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