Documentation ¶
Index ¶
- Constants
- func SessionID(req *http.Request) string
- type Error
- func Bad(e error, msg string, args ...interface{}) Error
- func Errorf(code int, e error, msg string, args ...interface{}) Error
- func Forbidden(e error, msg string, args ...interface{}) Error
- func NotFound(e error, msg string, args ...interface{}) Error
- func Oops(e error, msg string, args ...interface{}) Error
- func Unauthorized(e error, msg string, args ...interface{}) Error
- type Handler
- type Request
- func (r *Request) Fail(e Error)
- func (r *Request) Missing(params ...string) bool
- func (r *Request) OK(resp interface{})
- func (r *Request) Param(name, def string) string
- func (r *Request) ParamDate(name string) *time.Time
- func (r *Request) ParamDuration(name string) *time.Duration
- func (r *Request) ParamIs(name, want string) bool
- func (r *Request) Payload(v interface{}) bool
- func (r *Request) SessionID() string
- func (r *Request) SetCookie(cookie *http.Cookie)
- func (r *Request) SetRespHeader(header, value string)
- func (r *Request) String() string
- func (r *Request) Success(msg string, args ...interface{})
- func (r *Request) Upgrade() *WebSocket
- type Router
- type WebSocket
Constants ¶
View Source
const ( SessionHeaderKey = "X-Shield-Session" SessionCookieKey = "shield7" )
Variables ¶
This section is empty.
Functions ¶
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 Unauthorized ¶
func (*Error) ProvideDiagnostic ¶
func (e *Error) ProvideDiagnostic()
type Request ¶
func NewRequest ¶
NewRequest initializes and returns a new request object. Setting debug to true will cause errors to be logged.
func (*Request) ParamDuration ¶
ParamDuration parses a duration string, example: "1m30s" that will be 1 minute and 30 seconds
func (*Request) Payload ¶
Payload unmarshals the JSON body of this request into the given interface. Returns true if successful and false otherwise.
func (*Request) SetRespHeader ¶
Click to show internal directories.
Click to hide internal directories.