Documentation ¶
Index ¶
- func GenericRequestChainHandler(checkResponseOfEveryHandler bool, restrictHandler RestrictContextHandler, ...) httprouter.Handle
- func RequestChainContextHandler(responseHandler ResponseHandler, handlers ...ContextHandler) httprouter.Handle
- func RequestChainHandler(responseHandler ResponseHandler, handlers ...Handler) httprouter.Handle
- func RequestChainHandlerWithResponseCheck(checkResponseOfEveryHandler bool, responseHandler ResponseHandler, ...) httprouter.Handle
- func RestrictedRequestChainContextHandler(restrictHandler RestrictContextHandler, responseHandler ResponseHandler, ...) httprouter.Handle
- func RestrictedRequestChainContextHandlerWithResponseCheck(checkResponseOfEveryHandler bool, restrictHandler RestrictContextHandler, ...) httprouter.Handle
- func RestrictedRequestChainHandler(restrictHandler RestrictHandler, responseHandler ResponseHandler, ...) httprouter.Handle
- func RestrictedRequestChainHandlerWithResponseCheck(checkResponseOfEveryHandler bool, restrictHandler RestrictHandler, ...) httprouter.Handle
- type ContextHandler
- type ContextKey
- type Handler
- type Response
- type ResponseHandler
- type RestrictContextHandler
- type RestrictHandler
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericRequestChainHandler ¶
func GenericRequestChainHandler(checkResponseOfEveryHandler bool, restrictHandler RestrictContextHandler, responseHandler ResponseHandler, handlers ...ContextHandler) httprouter.Handle
GenericRequestChainHandler is the generic requestChainHandler.
checkResponseOfEveryHandler -> if true: check the responseCode after every handler. If httpStatus is != 0 or 200, stop to move on. restrictHandler -> if != nil: pass first this handler. Use this for example for AuthHandler responseHandler -> if != nil: pass at last this handler. Use this for example for a JSON-converter handlers -> all your handler-chain or middlewares or or or
func RequestChainContextHandler ¶
func RequestChainContextHandler(responseHandler ResponseHandler, handlers ...ContextHandler) httprouter.Handle
RequestChainContextHandler chains all handler
func RequestChainHandler ¶
func RequestChainHandler(responseHandler ResponseHandler, handlers ...Handler) httprouter.Handle
RequestChainHandler chains all handler
func RequestChainHandlerWithResponseCheck ¶
func RequestChainHandlerWithResponseCheck(checkResponseOfEveryHandler bool, responseHandler ResponseHandler, handlers ...Handler) httprouter.Handle
RequestChainHandlerWithResponseCheck chains all handler and check every response
func RestrictedRequestChainContextHandler ¶
func RestrictedRequestChainContextHandler(restrictHandler RestrictContextHandler, responseHandler ResponseHandler, handlers ...ContextHandler) httprouter.Handle
RestrictedRequestChainContextHandler need a RestrictHandler. A RestrictHandler returns bool if call is allowed.
func RestrictedRequestChainContextHandlerWithResponseCheck ¶
func RestrictedRequestChainContextHandlerWithResponseCheck(checkResponseOfEveryHandler bool, restrictHandler RestrictContextHandler, responseHandler ResponseHandler, handlers ...ContextHandler) httprouter.Handle
RestrictedRequestChainContextHandlerWithResponseCheck exec all handlers If checkResponseOfEveryHandler is true, handler check every response.
func RestrictedRequestChainHandler ¶
func RestrictedRequestChainHandler(restrictHandler RestrictHandler, responseHandler ResponseHandler, handlers ...Handler) httprouter.Handle
RestrictedRequestChainHandler need a RestrictHandler. A RestrictHandler returns bool if call is allowed.
func RestrictedRequestChainHandlerWithResponseCheck ¶
func RestrictedRequestChainHandlerWithResponseCheck(checkResponseOfEveryHandler bool, restrictHandler RestrictHandler, responseHandler ResponseHandler, handlers ...Handler) httprouter.Handle
RestrictedRequestChainHandlerWithResponseCheck need a RestrictHandler. If checkResponseOfEveryHandler is true, handler check every response.
Types ¶
type ContextHandler ¶
type ContextHandler func(context.Context, *Response, *http.Request, httprouter.Params) context.Context
ContextHandler a handler with the go-lang-context
type Handler ¶
type Handler func(*Response, *http.Request, httprouter.Params)
Handler represent a chainable Handler (middleware-like)
type Response ¶
type Response struct { Data interface{} Status Status }
Response struct for Handlers
type ResponseHandler ¶
type ResponseHandler func(*Response, http.ResponseWriter, *http.Request, httprouter.Params)
ResponseHandler required for every Endpoint
type RestrictContextHandler ¶
type RestrictContextHandler func(context.Context, *Response, *http.Request, httprouter.Params) (context.Context, bool)
RestrictContextHandler restrict handler for contextHandler
type RestrictHandler ¶
RestrictHandler restricts to handle following handlers