template

package
v0.0.0-...-1d9fd85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache map[string]*template.Template

type Data

type Data struct {
	CurrentYear int

	Snippet  domain.Snippet
	Snippets []domain.Snippet
	Form     domain.Form
	Flash    string
}

func NewData

func NewData(opts ...Option) Data

type Option

type Option func(data *Data)

func WithFlash

func WithFlash(flash string) Option

func WithForm

func WithForm(form domain.Form) Option

func WithSnippet

func WithSnippet(snippet domain.Snippet) Option

func WithSnippets

func WithSnippets(snippets []domain.Snippet) Option

type Page

type Page string
const (
	PageHome     Page = "home.gohtml"
	PageView     Page = "view.gohtml"
	PageCreate   Page = "create.gohtml"
	PageNotFound Page = "not_found.gohtml"
)

type Renderer

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

func NewRenderer

func NewRenderer() (*Renderer, error)

func (Renderer) RenderPage

func (r Renderer) RenderPage(page Page, data Data) ([]byte, error)

Jump to

Keyboard shortcuts

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