utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFlash

func GetFlash(w http.ResponseWriter, r *http.Request, name string) string

func GetUser

func GetUser(req *http.Request) string

func SetFlash

func SetFlash(w http.ResponseWriter, name string, value string)

func SetFlashPath

func SetFlashPath(w http.ResponseWriter, name string, value string, path string)

func WithUser

func WithUser(req *http.Request, user string) *http.Request

Types

type Controller

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

func Expose

func Expose[T any](state func(request *http.Request) (*T, error)) *Controller[T]

func (*Controller[T]) Action

func (ch *Controller[T]) Action(name string, handler func(writer http.ResponseWriter, request *http.Request, state *T) error) *Controller[T]

func (*Controller[T]) ServeHTTP

func (ch *Controller[T]) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*Controller[T]) View

func (ch *Controller[T]) View(viewTemplate *template.Template, handler func(writer http.ResponseWriter, request *http.Request, state *T) (any, error)) *Controller[T]

Jump to

Keyboard shortcuts

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