render

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultDir       = "views"
	DefaultExt       = ".gohtml"
	DefaultLayoutExt = ".layout"
)
View Source
var AuthURL string

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, r *http.Request, err error)

HTTP 400 error

func ExecuteLayout

func ExecuteLayout(w io.Writer, partial, view string, data any) error

func ExecutePartial

func ExecutePartial(w io.Writer, partial string, data any) error

func ExecuteView

func ExecuteView(w io.Writer, view string, data any) error

func Forbidden

func Forbidden(w http.ResponseWriter, r *http.Request)

HTTP 403 error

func InternalServerError

func InternalServerError(w http.ResponseWriter, r *http.Request, err error)

HTTP 500 error

func Layout

func Layout(w http.ResponseWriter, partial, view string, data any)

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request, err error)

HTTP 404 error

func Partial

func Partial(w http.ResponseWriter, partial string, data any)

func SetContentType

func SetContentType(w http.ResponseWriter)

func Unauthorized

func Unauthorized(w http.ResponseWriter, r *http.Request)

HTTP 401 error, redirects the user to the authentication url

func View

func View(w http.ResponseWriter, view string, data any)

Types

type Renderer

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

func ContentType

func ContentType(contentType string) *Renderer

func Dir

func Dir(dir string) *Renderer

func Ext

func Ext(ext string) *Renderer

func Funcs

func Funcs(funcs template.FuncMap) *Renderer

func MustParse

func MustParse() *Renderer

func New

func New() *Renderer

func Parse

func Parse() (*Renderer, error)

func (*Renderer) ContentType

func (r *Renderer) ContentType(contentType string) *Renderer

func (*Renderer) Dir

func (r *Renderer) Dir(dir string) *Renderer

func (*Renderer) ExecuteLayout

func (r *Renderer) ExecuteLayout(w io.Writer, layout, view string, data any) error

func (*Renderer) ExecutePartial

func (r *Renderer) ExecutePartial(w io.Writer, partial string, data any) error

func (*Renderer) ExecuteView

func (r *Renderer) ExecuteView(w io.Writer, view string, data any) error

func (*Renderer) Ext

func (r *Renderer) Ext(ext string) *Renderer

func (*Renderer) Funcs

func (r *Renderer) Funcs(funcMap template.FuncMap) *Renderer

func (*Renderer) Layout

func (r *Renderer) Layout(w http.ResponseWriter, partial, view string, data any)

func (*Renderer) MustParse

func (r *Renderer) MustParse() *Renderer

func (*Renderer) Parse

func (r *Renderer) Parse() (*Renderer, error)

func (*Renderer) Partial

func (r *Renderer) Partial(w http.ResponseWriter, partial string, data any)

func (*Renderer) SetContentType

func (r *Renderer) SetContentType(w http.ResponseWriter)

func (*Renderer) View

func (r *Renderer) View(w http.ResponseWriter, view string, data any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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