Documentation
¶
Index ¶
- Constants
- Variables
- func FormFileReadAll(c *gin.Context, fileName string) ([]byte, error)
- func GetDbPath() (string, error)
- func GetLogPath() string
- func ResponseError(c *gin.Context, err error)
- func ResponseFile(c *gin.Context, data []byte, fileName string)
- func ResponseMsg(c *gin.Context, code int, msg string)
- func ResponseOk(c *gin.Context)
- func ResponseOkWithData(c *gin.Context, data any)
- func ResponseOkWithList(c *gin.Context, list any, count ...int64)
- func ResponseWithData(c *gin.Context, code int, msg string, data any)
- type BaseResponse
- type UserClaim
Constants ¶
View Source
const ( CodeOk = 200 // 正常 CodeErr = -1 // 通用异常 CodeErrForceModify = 60201 // 强制修改时使用 CodeErrPlatform = 60202 // 第三方调用异常 CodeErrAuth = 60400 // 登录过期,请重新登录 CodeErrParam = 60403 // 参数异常 CodeErrDataNotExist = 60404 // 数据不存在 CodeErrDB = 60500 // 数据库异常 )
View Source
const ( MsgOk = "Success" MsgErr = "系统异常" MsgErrAuth = "登录过期,请重新登录" MsgErrParam = "参数异常" MsgErrDB = "数据库异常" MsgErrNet = "网络异常" MsgErrUsernameOrPassword = "用户名或密码错误" MsgErrOldPasswordWrong = "旧密码错误" MsgErrNameExist = "名称已存在" MsgErrDataNotExist = "暂无数据" )
Variables ¶
View Source
var ( // ErrNameExists 名称已存在 ErrNameExists = errors.New("name already exists") // ErrListenPortExists 监听端口已存在 ErrListenPortExists = errors.New("listen port already exists") // ErrProxyNotExist 代理不存在 ErrProxyNotExist = errors.New("proxy not exists") )
View Source
var ( AppName = "my-proxy" AppVersion = "1.0.0" DateTimeWithMilliLayout = "2006-01-02 15:04:05.000" JwtKey = "LnGvpbI59mPaSxA3" // ServerPortKey 服务端口 KEY ServerPortKey = "SERVER_PORT_KEY" )
Functions ¶
func FormFileReadAll ¶
FormFileReadAll 读取表单文件内容
func ResponseOkWithData ¶
ResponseOkWithData 携带数据的成功响应
Types ¶
type BaseResponse ¶
Click to show internal directories.
Click to hide internal directories.