Documentation
¶
Index ¶
- Constants
- func DefaultErrorHandler(ctx *Context, err error)
- type APIError
- type Context
- func (c *Context) Bind(dst interface{}) error
- func (c *Context) HTML(html string, statusCode ...int) error
- func (c *Context) HTMLBlob(b []byte, statusCode ...int) error
- func (c *Context) IsMethod(method string) bool
- func (c *Context) JSON(value interface{}, statusCode ...int) error
- func (c *Context) NewAPIError(err error, params ...interface{}) error
- func (c *Context) NoContent(statusCode ...int) error
- func (c *Context) Param(key string) (str string)
- func (c *Context) QueryString() string
- func (c *Context) Redirect(uri string, statusCode ...int) error
- func (c *Context) Render(b []byte) error
- func (c *Context) Response() *Response
- func (c *Context) SetCookie(cookie *http.Cookie)
- func (c *Context) Validate(i interface{}) error
- type ErrorResponse
- type Group
- func (g *Group) Any(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) GET(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) *Group
- func (g *Group) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) POST(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) PUT(path string, h HandlerFunc, m ...MiddlewareFunc)
- func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc)
- type HTTPError
- type HandlerFunc
- type Logger
- type Map
- type MiddlewareFunc
- type Paginator
- type Raptor
- func (r *Raptor) DELETE(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) GET(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) Group(path string, middleware ...MiddlewareFunc) *Group
- func (r *Raptor) HEAD(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) Handler() HandlerFunc
- func (r *Raptor) OPTIONS(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) PATCH(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) POST(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) PUT(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (r *Raptor) Start(port string, handler ...HandlerFunc) error
- func (r *Raptor) StartTLS(port string, certFile, keyFile string, handler ...HandlerFunc) error
- func (r *Raptor) Static(prefix, path string) *Raptor
- func (r *Raptor) StaticGzip(prefix, path string) *Raptor
- func (r *Raptor) Use(middleware ...MiddlewareFunc)
- type Response
- func (r *Response) BadGateway(err error) error
- func (r *Response) BadRequest(err error) error
- func (r *Response) Blob(contentType string, b []byte, statusCode ...int) error
- func (r *Response) Collection(data interface{}) error
- func (r *Response) Conflict(err error) error
- func (r *Response) Custom(data interface{}, statusCode ...int) error
- func (r *Response) ExpectationFailed(err error) error
- func (r *Response) Forbidden(err error) error
- func (r *Response) GatewayTimeout(err error) error
- func (r *Response) Gone(err error) error
- func (r *Response) InternalServerError(err error) error
- func (r *Response) Item(data interface{}) error
- func (r *Response) JSON(data interface{}, statusCode ...int) error
- func (r *Response) LengthRequired(err error) error
- func (r *Response) Locked(err error) error
- func (r *Response) MethodNotAllowed(err error) error
- func (r *Response) NoContent() error
- func (r *Response) NotAcceptable(err error) error
- func (r *Response) NotFound(err error) error
- func (r *Response) Paginate(p Paginator, data interface{}) error
- func (r *Response) PayloadTooLarge(err error) error
- func (r *Response) PreconditionFailed(err error) error
- func (r *Response) RequestTimeout(err error) error
- func (r *Response) ServiceUnavailable(err error) error
- func (r *Response) SetStatusCode(statusCode int) *Response
- func (r *Response) Success(data interface{}) error
- func (r *Response) Unauthorized(err error) error
- func (r *Response) UnprocessableEntity(err error) error
- func (r *Response) UnsupportedMediaType(err error) error
- func (r *Response) XML(data interface{}, statusCode ...int) error
Constants ¶
View Source
const ( MIMEApplicationJSON = "application/json" MIMEApplicationJavaScript = "application/javascript" MIMEApplicationXML = "application/xml" MIMETextXML = "text/xml" MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEApplicationProtobuf = "application/protobuf" MIMEApplicationMsgpack = "application/msgpack" MIMETextHTML = "text/html" MIMETextPlain = "text/plain" MIMEMultipartForm = "multipart/form-data" MIMEOctetStream = "application/octet-stream" )
MIME types
View Source
const ( HeaderAccept = "Accept" HeaderAcceptCharset = "Accept-Charset" HeaderAcceptEncoding = "Accept-Encoding" HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderCacheControl = "Cache-Control" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderConnection = "Connection" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastEventID = "Last-Event-ID" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXAccelBuffering = "X-Accel-Buffering" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXRealIP = "X-Real-IP" HeaderXRequestID = "X-Request-ID" HeaderXRequestedWith = "X-Requested-With" HeaderServer = "Server" HeaderOrigin = "Origin" HeaderUserAgent = "User-Agent" // Access control HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" // Security HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderXCSRFToken = "X-CSRF-Token" HeaderXPoweredBy = "X-Powered-By" )
HTTP Headers
View Source
const ( CONNECT = "CONNECT" DELETE = "DELETE" GET = "GET" HEAD = "HEAD" OPTIONS = "OPTIONS" PATCH = "PATCH" POST = "POST" PROPFIND = "PROPFIND" PUT = "PUT" TRACE = "TRACE" )
HTTP REQUEST METHODS :
Variables ¶
This section is empty.
Functions ¶
func DefaultErrorHandler ¶ added in v0.1.0
DefaultErrorHandler :
Types ¶
type APIError ¶
type APIError struct { Inner error Code string Message string Detail interface{} // contains filtered or unexported fields }
APIError :
type Context ¶
type Context struct { *fasthttp.RequestCtx // contains filtered or unexported fields }
Context :
func (*Context) NewAPIError ¶
NewAPIError :
type ErrorResponse ¶
ErrorResponse :
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group :
func (*Group) CONNECT ¶
func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc)
CONNECT :
func (*Group) DELETE ¶
func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc)
DELETE :
func (*Group) Group ¶
func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) *Group
Group :
func (*Group) OPTIONS ¶
func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc)
OPTIONS :
func (*Group) PATCH ¶
func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc)
PATCH :
func (*Group) TRACE ¶
func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc)
TRACE :
type Raptor ¶
type Raptor struct { ErrorHandler func(c *Context, err error) IsDebug bool // contains filtered or unexported fields }
Raptor :
func (*Raptor) DELETE ¶
func (r *Raptor) DELETE(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
DELETE :
func (*Raptor) GET ¶
func (r *Raptor) GET(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
GET :
func (*Raptor) Group ¶
func (r *Raptor) Group(path string, middleware ...MiddlewareFunc) *Group
Group :
func (*Raptor) HEAD ¶
func (r *Raptor) HEAD(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
HEAD :
func (*Raptor) OPTIONS ¶
func (r *Raptor) OPTIONS(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
OPTIONS :
func (*Raptor) PATCH ¶
func (r *Raptor) PATCH(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
PATCH :
func (*Raptor) POST ¶
func (r *Raptor) POST(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
POST :
func (*Raptor) PUT ¶
func (r *Raptor) PUT(path string, handler HandlerFunc, middleware ...MiddlewareFunc)
PUT :
type Response ¶
type Response struct {
*fasthttp.RequestCtx
}
Response :
func (*Response) ExpectationFailed ¶
ExpectationFailed : 417
func (*Response) GatewayTimeout ¶
GatewayTimeout : 504
func (*Response) InternalServerError ¶
InternalServerError : 500
func (*Response) LengthRequired ¶
LengthRequired : 411
func (*Response) MethodNotAllowed ¶
MethodNotAllowed : 405
func (*Response) NotAcceptable ¶
NotAcceptable : 406
func (*Response) PayloadTooLarge ¶
PayloadTooLarge : 413
func (*Response) PreconditionFailed ¶
PreconditionFailed : 412
func (*Response) RequestTimeout ¶
RequestTimeout : 408
func (*Response) ServiceUnavailable ¶
ServiceUnavailable : 503
func (*Response) SetStatusCode ¶
SetStatusCode :
func (*Response) UnprocessableEntity ¶
UnprocessableEntity : 422
func (*Response) UnsupportedMediaType ¶
UnsupportedMediaType : 415
Source Files
¶
Click to show internal directories.
Click to hide internal directories.