app

package
v0.0.0-...-2d47c91 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedRouter

func AuthenticatedRouter(db *database.Queries, currentUser func(r *http.Request) (*database.User, error), assetsFS fs.FS, eh ErrorHandler) func(r chi.Router)

func MethodSpoofing

func MethodSpoofing(next http.Handler) http.Handler

MethodSpoofing allows to spoof PUT, PATCH and DELETE methods from HTML forms, using the _method field.

func NewValidator

func NewValidator(valueOf func(string) string) *validator

func Router

func Router(isDevMode bool, cookieKey []byte, baseURL string, oidc auth.OIDC, db *database.Queries) (*chi.Mux, error)

Types

type BillingInfo

type BillingInfo struct {
	Kind       string
	Name       string
	Address1   string
	Address2   string
	PostalCode string
	City       string
	Country    string
}

type Data

type Data struct {
	Yield interface{}
}

Data is the top level structure that views expect data to come in.

type ErrorHandler

type ErrorHandler struct {
	Debug bool
}

func (ErrorHandler) Wrap

func (e ErrorHandler) Wrap(handler func(w http.ResponseWriter, r *http.Request) error) http.Handler

Wrap an http handler with an error

type View

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

func NewView

func NewView(fs fs.FS, layout string, funcMap func(r *http.Request) template.FuncMap, files ...string) *View

func (*View) Render

func (v *View) Render(w http.ResponseWriter, r *http.Request, data interface{}) error

Render is used to render the view with the predefined layout.

func (*View) ServeHTTP

func (v *View) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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