Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Ok = defaultFlag(1, "", "") ErrNil = defaultFlag(-1, "未知错误", "") ErrParams = defaultFlag(900, "param error", "") ErrVerifyAuth = defaultFlag(901, "用户异常", "") ErrLogin = defaultFlag(902, "登录失败", "") ErrNoPermissions = defaultFlag(903, "无权访问", "请联系管理员赋权") ErrVersionLow = defaultFlag(904, "版本号过低", "请下载最新版本") ErrSign = defaultFlag(905, "签名错误", "请检查签名") ErrXPwd = defaultFlag(906, "鉴权失败", "") ErrAuth = defaultFlag(907, "登录状态已过期", "请重新登录再试") )
default flag -1 - 999
View Source
var ValiObj *validator.Validate
View Source
var ValiTrans ut.Translator
Functions ¶
func Done ¶
func Done(c *gin.Context, res *ResponseBean)
func SetVersion ¶ added in v0.0.2
func SetVersion(v string)
Types ¶
type Flag ¶
type ResponseBean ¶
type ResponseBean struct { Kind ResponseKind `json:"-" xml:"-"` Version string `json:"-" xml:"version,attr"` Code int `json:"code"` Data interface{} `json:"data"` Message string `json:"message"` Detail string `json:"detail"` T string `json:"t"` }
ResponseBean @Description: 接口返回值定义
func ParamErr ¶
func ParamErr(err error) *ResponseBean
func Response ¶
func Response(code int, data interface{}, message string, detail string, kind ResponseKind) *ResponseBean
func ResponseErr ¶
func ResponseErr(flag Flag) *ResponseBean
func Success ¶
func Success(data interface{}) *ResponseBean
type ResponseKind ¶
type ResponseKind string
const ( ResponseKindJson ResponseKind = "json" ResponseKindXml ResponseKind = "xml" ResponseKindString ResponseKind = "string" ResponseKindFile ResponseKind = "file" )
Click to show internal directories.
Click to hide internal directories.