Documentation ¶
Index ¶
- Constants
- Variables
- func GetFsHandler(root string, stripSlashes int) fasthttp.RequestHandler
- type Kernel
- func (k *Kernel) FastHttpHandler(ctx *fasthttp.RequestCtx)
- func (k *Kernel) Handle(r contracts.RequestContract) (resp contracts.ResponseContract)
- func (k *Kernel) IsKeepAlive() bool
- func (k *Kernel) KeepAlive(b ...bool) *Kernel
- func (k *Kernel) SendRequestToRouter(r contracts.RequestContract) contracts.ResponseContract
- func (k *Kernel) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (k *Kernel) SetErrorHandler(handler errors.ErrorHandler)
- func (k *Kernel) SetMiddleware(ms []RequestMiddleware)
- func (k *Kernel) SetMiddlewareGroup(middlewareGroup map[string][]RequestMiddleware)
- func (k *Kernel) Use(m RequestMiddleware) *Kernel
- func (k *Kernel) Wrapper() *router.Wrapper
- type KernelRequestResolver
- type MiddlewareGroup
- type PipeFunc
- type PipeHandler
- type Pipeline
- func (p *Pipeline) Send(r contracts.RequestContract) *Pipeline
- func (p *Pipeline) Then(handler PipeHandler) contracts.ResponseContract
- func (p *Pipeline) Through(pipe interface{}) *Pipeline
- func (p *Pipeline) ThroughFunc(pipe PipeFunc) *Pipeline
- func (p *Pipeline) ThroughMiddleware(pipe RequestMiddleware) *Pipeline
- type RequestInjector
- type RequestMiddleware
- type RouterRegister
- type Server
Constants ¶
View Source
const ( HandlerFastHttp handlerType = iota HandlerNetHttp )
View Source
const DefaultConcurrency = 256 * 1024
View Source
const Version = "v0.0.7"
Variables ¶
View Source
var ( ReadTimeout = time.Second * 30 WriteTimeout = time.Second * 30 )
Functions ¶
func GetFsHandler ¶
func GetFsHandler(root string, stripSlashes int) fasthttp.RequestHandler
Types ¶
type Kernel ¶
type Kernel struct { RequestCurrency int MaxRequestBodySize int OutputLog bool Handler handlerType // contains filtered or unexported fields }
func (*Kernel) FastHttpHandler ¶
func (k *Kernel) FastHttpHandler(ctx *fasthttp.RequestCtx)
func (*Kernel) Handle ¶
func (k *Kernel) Handle(r contracts.RequestContract) (resp contracts.ResponseContract)
func (*Kernel) IsKeepAlive ¶
func (*Kernel) SendRequestToRouter ¶
func (k *Kernel) SendRequestToRouter(r contracts.RequestContract) contracts.ResponseContract
func (*Kernel) SetErrorHandler ¶
func (k *Kernel) SetErrorHandler(handler errors.ErrorHandler)
func (*Kernel) SetMiddleware ¶
func (k *Kernel) SetMiddleware(ms []RequestMiddleware)
func (*Kernel) SetMiddlewareGroup ¶
func (k *Kernel) SetMiddlewareGroup(middlewareGroup map[string][]RequestMiddleware)
func (*Kernel) Use ¶
func (k *Kernel) Use(m RequestMiddleware) *Kernel
type KernelRequestResolver ¶
type KernelRequestResolver struct { }
func (KernelRequestResolver) ResolveRequest ¶
func (rr KernelRequestResolver) ResolveRequest(r contracts.RequestContract, runtime container.Interface)
type MiddlewareGroup ¶
type MiddlewareGroup map[string][]RequestMiddleware
type PipeFunc ¶
type PipeFunc func(r contracts.RequestContract, next PipeHandler) contracts.ResponseContract
PipeFunc request middleware function
type PipeHandler ¶
type PipeHandler func(r contracts.RequestContract) contracts.ResponseContract
PipeHandler destination handler
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is request pipeline prepare for request middleware
func (*Pipeline) Send ¶
func (p *Pipeline) Send(r contracts.RequestContract) *Pipeline
Send request to pipeline
func (*Pipeline) Then ¶
func (p *Pipeline) Then(handler PipeHandler) contracts.ResponseContract
Then final destination
func (*Pipeline) ThroughFunc ¶
ThroughFunc through middleware function
func (*Pipeline) ThroughMiddleware ¶
func (p *Pipeline) ThroughMiddleware(pipe RequestMiddleware) *Pipeline
ThroughMiddleware through middleware struct
type RequestInjector ¶
type RequestInjector struct {
// contains filtered or unexported fields
}
RequestInjector inject request object, with validation
func (*RequestInjector) When ¶
func (r *RequestInjector) When(abs interface{}) bool
type RequestMiddleware ¶
type RequestMiddleware interface {
Handle(r contracts.RequestContract, next PipeHandler) contracts.ResponseContract
}
RequestMiddleware request middleware
type RouterRegister ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetFastHttpServer ¶
func (*Server) Serve ¶
func (s *Server) Serve(addr string, register RouterRegister)
Click to show internal directories.
Click to hide internal directories.