Documentation
¶
Index ¶
- Variables
- func BindAndValidate(c *gin.Context, req interface{}) bool
- func CreateGinServer(contextPath string) *gin.Engine
- func InitWebServer(ctx context.Context, webGroups []config.WebGroup, ...)
- func WrapSuccessResponse(resp *BaseResponse)
- type AppConfigLoadedEventListener
- type AppShutDownEventListener
- type BaseResponse
- type GinHandlerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SuccessResponse 成功响应对象 SuccessResponse = BaseResponse{Code: errs.Success.Code, Message: errs.Success.Message} // SystemErrResponse 系统异常 SystemErrResponse = BaseResponse{Code: errs.ErrSystem.Code, Message: errs.ErrSystem.Message} )
View Source
var GinWebRouter *gin.Engine
GinWebRouter Gin的web路由器
Functions ¶
func BindAndValidate ¶
BindAndValidate 绑定请求参数并校验,失败时打印原始参数和错误 参数:c Gin上下文,req 待绑定的结构体指针 返回:true=校验通过,false=校验失败(已自动返回错误响应)
func CreateGinServer ¶
func InitWebServer ¶
func InitWebServer(ctx context.Context, webGroups []config.WebGroup, validatorMap map[string]validator.Func, webMiddlewares ...gin.HandlerFunc)
InitWebServer 启动Web服务
func WrapSuccessResponse ¶
func WrapSuccessResponse(resp *BaseResponse)
Types ¶
type AppConfigLoadedEventListener ¶
type AppConfigLoadedEventListener struct{}
func (*AppConfigLoadedEventListener) GetOrder ¶
func (ace *AppConfigLoadedEventListener) GetOrder() int
func (*AppConfigLoadedEventListener) OnApplicationEvent ¶
func (ace *AppConfigLoadedEventListener) OnApplicationEvent(ctx context.Context, event *listener.AppConfigLoadedEvent)
type AppShutDownEventListener ¶
type AppShutDownEventListener struct{}
func (*AppShutDownEventListener) GetOrder ¶
func (l *AppShutDownEventListener) GetOrder() int
func (*AppShutDownEventListener) OnApplicationEvent ¶
func (l *AppShutDownEventListener) OnApplicationEvent(ctx context.Context, event *listener.AppShutdownEvent)
type BaseResponse ¶
type GinHandlerFunc ¶
type GinHandlerFunc struct {
Method string
Path string
Func gin.HandlerFunc
}
Click to show internal directories.
Click to hide internal directories.