html

package
v0.0.0-...-bde87b4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingContextKey = errors.New(
		"http/render: unable to retrieve render from request context. Make sure to use corresponding middleware.",
	)
)

Functions

func Middleware

func Middleware(r Renderer) middleware.MiddlewareFunc

func MustRender

func MustRender(w http.ResponseWriter, req *http.Request, name string, vars ...any)

MustRender is like Render, but panics if an error occurs.

func Render

func Render(w http.ResponseWriter, req *http.Request, name string, vars ...any) error

Render renders an HTML template with the given name and variables.

Types

type Renderer

type Renderer interface {
	// Render renders a template with the given name and data.
	Render(w io.Writer, name string, data any) error
}

Renderer renders a template using provided underlying engine.

func New

func New(f fs.FS, e engine.Engine) (Renderer, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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