Documentation
¶
Index ¶
- Constants
- Variables
- func CreateJSONError(c *gin.Context, errCode int)
- func CreateJSONExtra(c *gin.Context, extra interface{})
- func CreateJSONModel(c *gin.Context, model interface{})
- func CreateJSONModels(c *gin.Context, models []interface{})
- func CreateJSONPaging(c *gin.Context, models []interface{}, page *PageInfo)
- func CreateJSONsuccess(c *gin.Context)
- func ErrorBytes(errorCode int) []byte
- func HandleErrCode(errCode int) string
- func ModelBytes(model interface{}) []byte
- func ModelsBytes(models []interface{}) []byte
- type PageInfo
- type Reply
Constants ¶
View Source
const ( Success = iota Error DataNoExist ParamError LoginDisable LoginError AccessNoPrivilege ParamIncorrect InvalidToken RegisterAdmin AccountExist AccountNotExist PasswordError SyncPostsError UpdatePasswordError FileTypeError ImportFileError DatabaseSqlParseError LoginOverTime DataExist )
Variables ¶
View Source
var Errors = map[int]string{ Success: "操作成功", Error: "操作失败", DataNoExist: "该数据不存在", ParamError: "参数错误", LoginDisable: "账户已被禁用", LoginError: "登录失败,用户名或密码错误", AccessNoPrivilege: "不具备访问权限", ParamIncorrect: "传入参数有误", InvalidToken: "token解析失败", RegisterAdmin: "注册失败", AccountExist: "账号已存在", AccountNotExist: "用户不存在", PasswordError: "密码错误", SyncPostsError: "同步文章失败", UpdatePasswordError: "密码修改失败", FileTypeError: "文件类型错误", ImportFileError: "文件导入失败", DatabaseSqlParseError: "数据库解析异常", LoginOverTime: "登录超时", DataExist: "数据已存在", }
Functions ¶
func CreateJSONError ¶
func CreateJSONExtra ¶
func CreateJSONModel ¶
func CreateJSONModels ¶
func CreateJSONPaging ¶
func CreateJSONsuccess ¶
func ErrorBytes ¶
func HandleErrCode ¶
func ModelBytes ¶
func ModelBytes(model interface{}) []byte
func ModelsBytes ¶
func ModelsBytes(models []interface{}) []byte
Types ¶
type PageInfo ¶
type PageInfo struct { Page int64 `json:"page,omitempty"` Size int64 `json:"size,omitempty"` Total int64 `json:"total,omitempty"` }
func GetPageInfo ¶
type Reply ¶
type Reply struct { Success int `json:"success"` ReplyCode string `json:"resultCode"` Message string `json:"message"` Model interface{} `json:"model"` Models []interface{} `json:"models"` Pageinfo PageInfo `json:"pageInfo,omitempty"` Extra interface{} `json:"extra,omitempty"` }
func CreateWithError ¶
func CreateWithError() *Reply
func CreateWithErrorX ¶
func CreateWithModel ¶
func CreateWithModel(model interface{}) *Reply
func CreateWithModels ¶
func CreateWithModels(models []interface{}) *Reply
func CreateWithPaging ¶
func CreateWithSuccess ¶
func CreateWithSuccess() *Reply
Click to show internal directories.
Click to hide internal directories.