view

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapTemplateCache

type MapTemplateCache map[string]*template.Template

func (MapTemplateCache) Get

func (c MapTemplateCache) Get(name string) (*template.Template, bool)

func (MapTemplateCache) Set

func (c MapTemplateCache) Set(name string, tmpl *template.Template)

type NoopTemplateCache

type NoopTemplateCache struct{}

func (NoopTemplateCache) Get

func (c NoopTemplateCache) Get(name string) (*template.Template, bool)

func (NoopTemplateCache) Set

func (c NoopTemplateCache) Set(name string, tmpl *template.Template)

type RenderEngine

type RenderEngine struct {
	Views     fs.FS
	Includes  fs.FS
	Cache     TemplateCache
	FuncMap   template.FuncMap
	HandleErr func(context.Context, *RenderEngine, http.ResponseWriter, error)
	Logger    logging.Logger
}

func (*RenderEngine) ParseAll

func (e *RenderEngine) ParseAll() error

func (*RenderEngine) Render

func (e *RenderEngine) Render(ctx context.Context, w http.ResponseWriter, status int, r Renderable)

type Renderable

type Renderable interface {
	Name() string
	Block() string
	Data() any
}

type TemplateCache

type TemplateCache interface {
	Get(name string) (*template.Template, bool)
	Set(name string, tmpl *template.Template)
}

type View

type View[T any] struct {
	// contains filtered or unexported fields
}

func NewView

func NewView[T any](name, block string, data T) *View[T]

func (*View[T]) Block

func (v *View[T]) Block() string

func (*View[T]) Data

func (v *View[T]) Data() any

func (*View[T]) Name

func (v *View[T]) Name() string

Jump to

Keyboard shortcuts

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