scout

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FlashCookieName = "flash"

Variables

This section is empty.

Functions

func CurrentPath

func CurrentPath(r *http.Request) string

func Path

func Path(root string, id string, suffixes ...string) string

func Url

func Url(root string, id string, suffixes ...string) string

Types

type BranchType

type BranchType map[string]*PathType

func Branch

func Branch() BranchType

type ErrorPageType

type ErrorPageType func(err Response) fido.Element

type Flash

type Flash struct {
	Id      int64
	Message string
	Urgency Urgency
	Expiry  int
}

type Flashes added in v1.0.4

type Flashes []Flash

func NewFlash

func NewFlash() *Flashes

func (*Flashes) Add added in v1.0.4

func (f *Flashes) Add(msg string, ugency Urgency, expiry ...int)

func (*Flashes) Clear added in v1.0.4

func (f *Flashes) Clear(w http.ResponseWriter)

func (*Flashes) Decode added in v1.0.4

func (f *Flashes) Decode(encoded string) error

Decode the flash struct from a cookie value

func (*Flashes) Encode added in v1.0.4

func (f *Flashes) Encode() ([]byte, error)

Encode the flash struct to base64 to store in a cookie

func (*Flashes) Error added in v1.0.4

func (f *Flashes) Error(msg string, expiry ...int)

func (*Flashes) Info added in v1.0.4

func (f *Flashes) Info(msg string, expiry ...int)

func (*Flashes) Save added in v1.0.4

func (f *Flashes) Save(w http.ResponseWriter) error

func (*Flashes) Success added in v1.0.4

func (f *Flashes) Success(msg string, expiry ...int)

func (*Flashes) Warning added in v1.0.4

func (f *Flashes) Warning(msg string, expiry ...int)

type Handler

type Handler func(http.ResponseWriter, *http.Request) Response

type Layout

type Layout func(w http.ResponseWriter, r *http.Request, flashes Flashes, content []fido.Element) fido.Element

type PathType

type PathType map[string]Handler

func (*PathType) Delete

func (r *PathType) Delete(handler Handler) *PathType

func (*PathType) Get

func (r *PathType) Get(handler Handler) *PathType

func (*PathType) Handle

func (r *PathType) Handle(method string, handler Handler) *PathType

func (*PathType) Map

func (r *PathType) Map(route PathType) *PathType

func (*PathType) Patch

func (r *PathType) Patch(handler Handler) *PathType

func (*PathType) Post

func (r *PathType) Post(handler Handler) *PathType

func (*PathType) Put

func (r *PathType) Put(handler Handler) *PathType

type Response

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

func Back

func Back() Response

func Content

func Content(content ...fido.Element) Response

func Error

func Error(err error, expiry ...int) Response

func Info added in v1.1.0

func Info(msg string, expiry ...int) Response

func Redirect

func Redirect(url string) Response

func Respond added in v1.0.4

func Respond() Response

func Success

func Success(msg string, expiry ...int) Response

func Warning added in v1.1.0

func Warning(msg string, expiry ...int) Response

func (Response) Back added in v1.0.4

func (r Response) Back() Response

func (Response) Content added in v1.0.4

func (r Response) Content(content ...fido.Element) Response

func (Response) Error added in v1.0.4

func (r Response) Error(err error, expiry ...int) Response

func (Response) GetContent added in v1.0.4

func (r Response) GetContent() []fido.Element

func (Response) Header added in v1.0.4

func (r Response) Header(key, value string) Response

func (Response) Info added in v1.0.4

func (r Response) Info(msg string, expiry ...int) Response

func (Response) Notify added in v1.0.4

func (r Response) Notify(msg string, urgency Urgency, expiry ...int) Response

func (Response) PushUrl added in v1.0.4

func (r Response) PushUrl(url string) Response

func (Response) Redirect added in v1.0.4

func (r Response) Redirect(url string) Response

func (Response) ReplaceUrl added in v1.0.4

func (r Response) ReplaceUrl(url string) Response

func (Response) Success added in v1.0.4

func (r Response) Success(msg string, expiry ...int) Response

func (Response) Warning added in v1.0.4

func (r Response) Warning(msg string, expiry ...int) Response

type Router

type Router struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func New

func New(mux *http.ServeMux, layout Layout) *Router

func (*Router) Handle

func (router *Router) Handle(pattern string, handler func(http.ResponseWriter, *http.Request))
func (router *Router) Route(router *Router) *Router {
	for path, route := range routes {
		router.Path(path).Map(*route)
	}
	return router
}

func (*Router) HandleFunc

func (router *Router) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*Router) Path

func (router *Router) Path(path string) *PathType

func (*Router) Verbose

func (router *Router) Verbose(verbose bool)

type Urgency

type Urgency string
const (
	SuccessUrgency Urgency = "success"
	ErrorUrgency   Urgency = "error"
	InfoUrgency    Urgency = "info"
	WarningUrgency Urgency = "warning"
)

Jump to

Keyboard shortcuts

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