Documentation ¶
Index ¶
- func CommonResponse(c *gin.Context, code RespCode, httpCode int, data interface{}, err error)
- func EF(err error)
- func GenHash(src string) string
- func GenPassHash(src string) (hashStr, salt string)
- func GenTraceId(ip string) (traceId string)
- func GetLocalIPs() (ips []net.IP)
- func IsValidPasswd(passStr, salt, passHash string) bool
- func ResponseClientError(c *gin.Context, err error)
- func ResponseInvalidParam(c *gin.Context, err error)
- func ResponseMethodNotAllowed(c *gin.Context, err error)
- func ResponseOk(c *gin.Context, data interface{})
- func ResponseServerError(c *gin.Context, err error)
- func ResponseUnAuthorized(c *gin.Context, err error)
- type RespCode
- type RespStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonResponse ¶
通用响应封装
func GenTraceId ¶
func GetLocalIPs ¶
func ResponseClientError ¶
客户端错误响应的封装 (http 400)
func ResponseServerError ¶
服务端错误响应的封装 (http 500)
Types ¶
type RespCode ¶
type RespCode int
type RespStruct ¶
type RespStruct struct { Code RespCode `json:"code"` Msg string `json:"code_msg"` Error string `json:"error"` Data interface{} `json:"data"` }
统一返回消息体
Click to show internal directories.
Click to hide internal directories.