Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SuccessRespHeader = BaseRespHeader{Code: http.StatusOK, Msg: "ok"} SystemErrorRespHeader = BaseRespHeader{Code: http.StatusInternalServerError, Msg: "系统异常"} ParamErrorRespHeader = BaseRespHeader{Code: http.StatusBadRequest, Msg: "参数错误"} ForbiddenErrorRespHeader = BaseRespHeader{Code: http.StatusForbidden, Msg: "拒绝服务"} )
Functions ¶
func EasyHandler ¶
func EasyHandler(cf CheckFunc, lf LogicFunc, req interface{}) gin.HandlerFunc
解析请求,整合检查请求参数,响应逻辑,并响应
func URLPatterns ¶
func URLPatterns(route RouteAdapter, path string, childRoute DoChildRouteFunc, middles ...gin.HandlerFunc)
URL 调度器
Types ¶
type BaseReqInter ¶
type BaseRespHeader ¶
type BaseRespInter ¶
type BaseRespInter = interface{}
type CheckFunc ¶
type CheckFunc func(ctx *gin.Context, req BaseReqInter) (BaseRespInter, error)
type DoChildRouteFunc ¶
type DoChildRouteFunc func(g *gin.RouterGroup) // 子路由
type LogicFunc ¶
type LogicFunc func(ctx *gin.Context, req BaseReqInter) BaseRespInter
type RouteAdapter ¶
type RouteAdapter interface {
Use(middleware ...gin.HandlerFunc) gin.IRoutes
Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
}
用于适配 Engine 和 RouteGroup
Click to show internal directories.
Click to hide internal directories.