Documentation
¶
Overview ¶
* @Author: hugo * @Date: 2024-04-19 17:54 * @LastEditors: hugo * @LastEditTime: 2024-07-31 17:50 * @FilePath: \gotox\webx\handler.go * @Description: * * Copyright (c) 2024 by hugo, All Rights Reserved.
Index ¶
- func SetLogger(l logx.Logger)
- func Wrap(fn func(ctx *gin.Context) (Response, error)) gin.HandlerFunc
- func WrapBind[T any](fn func(ctx *gin.Context, req T) (Response, error)) gin.HandlerFunc
- func WrapBindQueryAndBody[Q any, B any](fn func(ctx *gin.Context, query Q, body B) (Response, error)) gin.HandlerFunc
- func WrapPage(fn func(ctx *gin.Context, page, pageSize int) (Response, error)) gin.HandlerFunc
- type ErrMsg
- type Handler
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapBindQueryAndBody ¶
Types ¶
type Response ¶
type Response struct {
// Code 响应的业务错误码。0表示业务执行成功,非0表示业务执行失败。
Code int `json:"code"`
// Message 响应的参考消息。前端可使用msg来做提示
Message string `json:"msg"`
// Data 响应的具体数据
Data any `json:"data"`
}
Response 统一的响应格式
func ResponseErr ¶
func ResponseSuccess ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
middleware
|
|
|
auth
* @Author: hugo * @Date: 2024-04-28 16:51 * @LastEditors: hugo * @LastEditTime: 2024-09-10 16:02 * @FilePath: \gotox\webx\middleware\auth\auth.go * @Description: * * Copyright (c) 2024 by hugo, All Rights Reserved.
|
* @Author: hugo * @Date: 2024-04-28 16:51 * @LastEditors: hugo * @LastEditTime: 2024-09-10 16:02 * @FilePath: \gotox\webx\middleware\auth\auth.go * @Description: * * Copyright (c) 2024 by hugo, All Rights Reserved. |
Click to show internal directories.
Click to hide internal directories.