Documentation
¶
Index ¶
- Constants
- func CustomProtoDecoratorMaker(validateFailedHandler ValidateFailedHandler, ...) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
- func DefaultProtoDecoratorMaker(validateFailedCode int32, unexpectedECode int32) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
- func InterConnProtoDecoratorMaker(validateFailedCode int32, unexpectedECode int32) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
- func ProtoDecorator(e framework.ConfBeanRegistry, handler api.ProtoHandler, ...) gin.HandlerFunc
- type BizFlow
- type PostProcessHandler
- type PreRenderHandler
- type ProtoDecoratorOptions
- type UnexpectedErrorHandler
- type ValidateFailedHandler
Constants ¶
const REQUEST = "REQUEST"
const RESPONSE = "RESPONSE"
Variables ¶
This section is empty.
Functions ¶
func CustomProtoDecoratorMaker ¶
func CustomProtoDecoratorMaker(validateFailedHandler ValidateFailedHandler, unexpectedErrorHandler UnexpectedErrorHandler) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
CustomProtoDecoratorMaker returns custom connection ProtoDecorator.
func DefaultProtoDecoratorMaker ¶
func DefaultProtoDecoratorMaker(validateFailedCode int32, unexpectedECode int32) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
DefaultProtoDecoratorMaker returns default ProtoDecorator.
func InterConnProtoDecoratorMaker ¶
func InterConnProtoDecoratorMaker(validateFailedCode int32, unexpectedECode int32) func(framework.ConfBeanRegistry, api.ProtoHandler) gin.HandlerFunc
InterConnProtoDecoratorMaker returns inter connection ProtoDecorator.
func ProtoDecorator ¶
func ProtoDecorator(e framework.ConfBeanRegistry, handler api.ProtoHandler, options *ProtoDecoratorOptions) gin.HandlerFunc
ProtoDecorator is the decorator of protocol request processing logic. During request processing, ProtoDecorator uses ShouldBindBodyWith of ginContext to read requests with contentType of "text/plain", "application/json" and "", so that other middleware can use ShouldBindBodyWith to read the request body again.
Types ¶
type PostProcessHandler ¶
type PostProcessHandler func(response api.ProtoResponse, bizContext *api.BizContext)
PostProcessHandler is post processor after frame processing.
type PreRenderHandler ¶
type PreRenderHandler func(bizContext *api.BizContext, render bizrender.Render)
PreRenderHandler is pre processor before rendering results.
type ProtoDecoratorOptions ¶
type ProtoDecoratorOptions struct { // Required ValidateFailedHandler // Required UnexpectedErrorHandler // Optional PostProcessHandler // Optional PreRenderHandler // Optional, have no use if `MarshalOptions` is set RenderJSONUseProtoNames bool // Optional *protojson.MarshalOptions }
type UnexpectedErrorHandler ¶
type UnexpectedErrorHandler func(flow *BizFlow, errs *errorcode.Errs) api.ProtoResponse
UnexpectedErrorHandler is processor when the framework handles exceptions.
type ValidateFailedHandler ¶
type ValidateFailedHandler func(flow *BizFlow, errs *errorcode.Errs) api.ProtoResponse
ValidateFailedHandler is processor when verification fails.