route

package
v0.0.0-...-be8df21 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Diagnostic string   `json:"diagnostic,omitempty"`
	Message    string   `json:"error,omitempty"`
	Missing    []string `json:"missing,omitempty"`
	// contains filtered or unexported fields
}

func Bad

func Bad(e error, msg string, args ...interface{}) Error

func Errorf

func Errorf(code int, e error, msg string, args ...interface{}) Error

func Forbidden

func Forbidden(e error, msg string, args ...interface{}) Error

func NotFound

func NotFound(e error, msg string, args ...interface{}) Error

func Oops

func Oops(e error, msg string, args ...interface{}) Error

func Unauthorized

func Unauthorized(e error, msg string, args ...interface{}) Error

func (Error) Error

func (e Error) Error() string

func (*Error) ProvideDiagnostic

func (e *Error) ProvideDiagnostic()

type Handler

type Handler func(r *Request)

type Request

type Request struct {
	Req  *http.Request
	Args []string
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(w http.ResponseWriter, r *http.Request, debug bool) *Request

func (*Request) BasicAuthorized

func (r *Request) BasicAuthorized(username, password, realm string) bool

func (*Request) Done

func (r *Request) Done() bool

func (*Request) Fail

func (r *Request) Fail(e Error)

func (*Request) Missing

func (r *Request) Missing(params ...string) bool

func (*Request) OK

func (r *Request) OK(resp interface{})

func (*Request) Param

func (r *Request) Param(name, def string) string

func (*Request) ParamDate

func (r *Request) ParamDate(name string) *time.Time

func (*Request) ParamDuration

func (r *Request) ParamDuration(name string) *time.Duration

func (*Request) ParamIs

func (r *Request) ParamIs(name, want string) bool

func (*Request) Payload

func (r *Request) Payload(v interface{}) bool

func (*Request) Redirect

func (r *Request) Redirect(code int, to string)

func (*Request) RemoteIP

func (r *Request) RemoteIP() string

func (*Request) Respond

func (r *Request) Respond(code int, typ, msg string, args ...interface{})

func (*Request) String

func (r *Request) String() string

func (*Request) Success

func (r *Request) Success(msg string, args ...interface{})

func (*Request) Upgrade

func (r *Request) Upgrade(settings WebSocketSettings) *WebSocket

func (*Request) UserAgent

func (r *Request) UserAgent() string

type Router

type Router struct {
	Debug bool
	// contains filtered or unexported fields
}

func (*Router) Dispatch

func (r *Router) Dispatch(match string, handler Handler)

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

type WebSocket

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

func (*WebSocket) Discard

func (ws *WebSocket) Discard(onclose func())

func (*WebSocket) Ping

func (ws *WebSocket) Ping() error

func (*WebSocket) SendClose

func (ws *WebSocket) SendClose() error

func (*WebSocket) Write

func (ws *WebSocket) Write(b []byte) (bool, error)

type WebSocketSettings

type WebSocketSettings struct {
	WriteTimeout time.Duration
}

Jump to

Keyboard shortcuts

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