package
Version:
v0.0.15
Opens a new window with list of versions in this module.
Published: Jan 19, 2024
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
- Constants
-
func APIException(c *gin.Context, code int, msg string, data any)
-
func APIFailure(c *gin.Context, msg string, data any)
-
func APISuccess(c *gin.Context, data any, count int)
-
func APISuccessBytes(c *gin.Context, data []byte, count int)
-
func APISuccessBytesData(data []byte, count int) []byte
-
func APISuccessNil(c *gin.Context)
-
func TxtException(c *gin.Context, code int, msg string)
-
func TxtMsg(c *gin.Context, msg string)
-
type APIData
View Source
const MIMEApplicationJSONCharsetUTF8 = "application/json; charset=utf-8"
APIFailure 返回失败, 状态码: 400
APISuccess 返回成功, 状态码: 200
APISuccessBytes 返回成功, JSON 字节数据, 状态码: 200
func APISuccessBytesData(data []byte, count int) []byte
APISuccessBytesData API 请求成功返回值(JSON Bytes)
APISuccessNil 返回成功, 无数据, 状态码: 200
type APIData struct {
OK int `json:"ok"`
Code int `json:"code"`
Msg string `json:"msg"`
Data any `json:"data"`
Count int `json:"count"`
}
APIData API 标准返回, 内部规范
ok: 1, code: 0 成功; ok: 0, code: 1 失败
成功时 msg 必定为空
APIFailureData API 请求失败返回值
APISuccessData API 请求成功返回值
APISuccessNilData API 请求成功返回, 无数据
Source Files
¶
Click to show internal directories.
Click to hide internal directories.