scout

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: GPL-3.0 Imports: 10 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 ResponseType) fido.Element

type Flash

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

type FlashCollection

type FlashCollection []Flash

func NewFlash

func NewFlash() *FlashCollection

func (*FlashCollection) Add

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

func (*FlashCollection) Clear

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

func (*FlashCollection) Decode

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

Decode the flash struct from base64 from a cookie

func (*FlashCollection) Encode

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

Encode the flash struct to base64 to store in a cookie

func (*FlashCollection) Error

func (f *FlashCollection) Error(msg string)

func (*FlashCollection) Info

func (f *FlashCollection) Info(msg string)

func (*FlashCollection) Save

func (*FlashCollection) Success

func (f *FlashCollection) Success(msg string)

func (*FlashCollection) Warning

func (f *FlashCollection) Warning(msg string)

type Handler

type Layout

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 ResponseStruct

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

func Response

func Response() *ResponseStruct

func (*ResponseStruct) Back

func (r *ResponseStruct) Back() *ResponseStruct

func (*ResponseStruct) Content

func (r *ResponseStruct) Content(content ...fido.Element) *ResponseStruct

func (*ResponseStruct) Err

func (r *ResponseStruct) Err() error

func (*ResponseStruct) ErrDetail

func (r *ResponseStruct) ErrDetail() string

func (*ResponseStruct) ErrPublic

func (r *ResponseStruct) ErrPublic() string

func (*ResponseStruct) Error

func (r *ResponseStruct) Error(err error) *ResponseStruct

func (*ResponseStruct) GetContent

func (r *ResponseStruct) GetContent() []fido.Element

func (*ResponseStruct) Header

func (r *ResponseStruct) Header(key, value string) *ResponseStruct

func (*ResponseStruct) Info

func (r *ResponseStruct) Info(msg string) *ResponseStruct

func (*ResponseStruct) PushUrl

func (r *ResponseStruct) PushUrl(url string) *ResponseStruct

func (*ResponseStruct) Redirect

func (r *ResponseStruct) Redirect(url string) *ResponseStruct

func (*ResponseStruct) ReplaceUrl

func (r *ResponseStruct) ReplaceUrl(url string) *ResponseStruct

func (*ResponseStruct) Success

func (r *ResponseStruct) Success(msg string) *ResponseStruct

func (*ResponseStruct) Warning

func (r *ResponseStruct) Warning(msg string) *ResponseStruct

func (*ResponseStruct) Wrap

func (r *ResponseStruct) Wrap(msg string) *ResponseStruct

Error(err).WrapErr("This dog has wandered off.")

type ResponseType

type ResponseType interface {
	Error(err error) *ResponseStruct
	Content(content ...fido.Element) *ResponseStruct
	Success(msg string) *ResponseStruct
	Header(key, value string) *ResponseStruct
	Warning(msg string) *ResponseStruct
	Info(msg string) *ResponseStruct
	Redirect(url string) *ResponseStruct
	PushUrl(url string) *ResponseStruct
	Back() *ResponseStruct
	ReplaceUrl(url string) *ResponseStruct
	Err() error
	ErrPublic() string
	ErrDetail() string
	GetContent() []fido.Element
	Wrap(msg string) *ResponseStruct
}

func Back

func Back() ResponseType

func Content

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

func Error

func Error(err error) ResponseType

func Redirect

func Redirect(url string) ResponseType

func Success

func Success(msg string) ResponseType

type Router

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

func New

func New(mux *http.ServeMux, layout Layout, errorPage ErrorPageType) *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