reply

package
v0.0.0-...-5b4efa0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

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 CreateJSONError(c *gin.Context, errCode int)

func CreateJSONExtra

func CreateJSONExtra(c *gin.Context, extra interface{})

func CreateJSONModel

func CreateJSONModel(c *gin.Context, model interface{})

func CreateJSONModels

func CreateJSONModels(c *gin.Context, models []interface{})

func CreateJSONPaging

func CreateJSONPaging(c *gin.Context, models []interface{}, page *PageInfo)

func CreateJSONsuccess

func CreateJSONsuccess(c *gin.Context)

func ErrorBytes

func ErrorBytes(errorCode int) []byte

func HandleErrCode

func HandleErrCode(errCode int) string

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

func GetPageInfo(basevo *models.BaseVO) PageInfo

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 CreateWithErrorX(errCode int) *Reply

func CreateWithModel

func CreateWithModel(model interface{}) *Reply

func CreateWithModels

func CreateWithModels(models []interface{}) *Reply

func CreateWithPaging

func CreateWithPaging(models []interface{}, page *PageInfo) *Reply

func CreateWithSuccess

func CreateWithSuccess() *Reply

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL