Documentation ¶
Index ¶
- Variables
- func BadRequestError() *common.Error
- func MethodNotAllowed(ctx *fasthttp.RequestCtx)
- func MethodNotAllowedError(method string) *common.Error
- func NotFound(ctx *fasthttp.RequestCtx)
- func NoteTime(next http.Handler) http.Handler
- func RegisterHandlers(router *fasthttprouter.Router)
- func RouteNotFindError(path string) *common.Error
- func SetErrorResponse(ctx *fasthttp.RequestCtx, err *common.Error)
- func SetHttpServerInv(httpServer HttpServer)
- func SetResponse(ctx *fasthttp.RequestCtx, resp []byte)
- func SetResponseError(w *http.ResponseWriter, error2 *common.Error)
- type HttpRequest
- type HttpServer
- type Middleware
- type MiddlewareChain
- type Response
- type Route
- type RouteGroup
- type Validation
Constants ¶
This section is empty.
Variables ¶
View Source
var (
API = map[string]*Route{}
)
View Source
var (
SaiHttpServer = &HttpServer{}
)
Functions ¶
func BadRequestError ¶
func MethodNotAllowed ¶
func MethodNotAllowed(ctx *fasthttp.RequestCtx)
func MethodNotAllowedError ¶
func NotFound ¶
func NotFound(ctx *fasthttp.RequestCtx)
func RegisterHandlers ¶
func RegisterHandlers(router *fasthttprouter.Router)
func RouteNotFindError ¶
func SetErrorResponse ¶
func SetErrorResponse(ctx *fasthttp.RequestCtx, err *common.Error)
func SetHttpServerInv ¶
func SetHttpServerInv(httpServer HttpServer)
func SetResponse ¶
func SetResponse(ctx *fasthttp.RequestCtx, resp []byte)
func SetResponseError ¶
func SetResponseError(w *http.ResponseWriter, error2 *common.Error)
Types ¶
type HttpRequest ¶
type HttpRequest struct { Query url.Values Body map[string]interface{} Params map[string]interface{} Route *Route Session *auth.Session Response *Response ResponseChannel chan *Response }
func CreateRequest ¶
func CreateRequest() HttpRequest
func GetRequest ¶
func (*HttpRequest) GetParam ¶
func (httpRequest *HttpRequest) GetParam(key string) (interface{}, bool)
func (*HttpRequest) ParseParams ¶
func (httpRequest *HttpRequest) ParseParams()
type HttpServer ¶
func (*HttpServer) Address ¶
func (httpServer *HttpServer) Address() string
func (*HttpServer) Start ¶
func (httpServer *HttpServer) Start()
type Middleware ¶
type Middleware func(handler fasthttp.RequestHandler) fasthttp.RequestHandler
type MiddlewareChain ¶
type MiddlewareChain struct {
// contains filtered or unexported fields
}
func CreateMiddlewareChain ¶
func CreateMiddlewareChain(middlewares ...Middleware) *MiddlewareChain
func (*MiddlewareChain) Append ¶
func (c *MiddlewareChain) Append(middlewares ...Middleware) *MiddlewareChain
func (*MiddlewareChain) Extend ¶
func (c *MiddlewareChain) Extend(chain MiddlewareChain) *MiddlewareChain
func (*MiddlewareChain) Then ¶
func (c *MiddlewareChain) Then(h fasthttp.RequestHandler) fasthttp.RequestHandler
type Response ¶
func (*Response) SetBodyString ¶
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc func(r *Route) Handlerr func(*HttpRequest) Handler fasthttp.RequestHandler RouteGroup *RouteGroup Permission auth.Rights Validations []Validation }
func (*Route) Handle ¶
func (route *Route) Handle(request *HttpRequest)
type RouteGroup ¶
type RouteGroup struct {
Chain *MiddlewareChain
}
Click to show internal directories.
Click to hide internal directories.