Documentation ¶
Index ¶
- func All[T any](ts []T, pred func(T) bool) bool
- func DoAll[T any](ts []T, pred func(T) error) error
- type HandlerFuncPair
- type HandlerGenerator
- type HandlerPair
- type Router
- func (r *Router) AddHandler(path string, handler http.Handler)
- func (r *Router) AddHandlerFunc(path string, handler http.HandlerFunc)
- func (r *Router) AddHandlerGen(handleGen HandlerGenerator)
- func (r *Router) GetHttpHandler() (path string, handler http.Handler)
- func (r *Router) Halt() error
- func (r *Router) IsHalted() bool
- func (r *Router) IsRunning() bool
- func (r *Router) Run() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerFuncPair ¶
type HandlerFuncPair struct {
// contains filtered or unexported fields
}
type HandlerGenerator ¶
type HandlerGenerator interface { // If a HandlerGenerator does not run a goroutine, then Run() and Halt() are no-ops and IsRunning and IsHalted() always return true Run() error // Run() should be idempotent Halt() error IsRunning() bool IsHalted() bool GetHttpHandlers() []*HandlerPair }
Common server implementation boilerplate
type HandlerPair ¶
type HandlerPair struct {
// contains filtered or unexported fields
}
func NewHandlerPair ¶
func NewHandlerPair(path string, handler http.Handler) *HandlerPair
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) AddHandlerFunc ¶
func (r *Router) AddHandlerFunc(path string, handler http.HandlerFunc)
func (*Router) AddHandlerGen ¶
func (r *Router) AddHandlerGen(handleGen HandlerGenerator)
func (*Router) GetHttpHandler ¶
Click to show internal directories.
Click to hide internal directories.