resource

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	Templater builder
	Rendered  bytes.Buffer
}

func NewResource

func NewResource(context interface{}, templatePatterns ...string) (*Resource, error)

func (*Resource) HTML

func (r *Resource) HTML() template.HTML

Return a template.HTML version of the rendered resource

func (*Resource) Render

func (r *Resource) Render() error

Call on a Resource to compile the template with the given context. Result is stored in r.Rendered, a bytes.Buffer

func (*Resource) WriteTo

func (r *Resource) WriteTo(w http.ResponseWriter) error

Write the rendered resource to the http.ResponseWriter

Jump to

Keyboard shortcuts

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