response

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS = 0
	ERROR   = 7000

	ParamError = 8000

	AuthError           = 1000
	UserRegisterFail    = 1003
	UserNameEmpty       = 1004
	UserPassEmpty       = 1005
	UserDisable         = 1006
	Forbidden           = http.StatusForbidden
	InternalServerError = http.StatusInternalServerError

	CreateK8SClusterError = 2000

	LDAPUserLoginFailed = 3000
	LDAPUserNotFound    = 3001
)
View Source
const (
	OkMsg    = "操作成功"
	NotOkMsg = "操作失败"

	ParamErrorMsg = "参数绑定失败, 请检查数据类型"

	LoginCheckErrorMsg     = "用户名或密码错误"
	UserRegisterFailMsg    = "用户注册失败"
	UserNameEmptyMsg       = "用户不能为空"
	UserPassEmptyMsg       = "密码不能为空"
	UserDisableMsg         = "用户已被禁用"
	ForbiddenMsg           = "无权访问该资源"
	InternalServerErrorMsg = "服务器内部错误"

	CreateK8SClusterErrorMsg = "创建K8S集群失败"

	LDAPUserLoginFailedMsg = "登录失败,请检查您的用户名和密码!"
	LDAPUserNotFoundMsg    = "用户不存在"
)

Variables

Functions

func Fail

func Fail(c *gin.Context)

func FailWithDetailed

func FailWithDetailed(data interface{}, code int, message string, c *gin.Context)

func FailWithMessage

func FailWithMessage(code int, message string, c *gin.Context)

func Ok

func Ok(c *gin.Context)

func OkWithData

func OkWithData(data interface{}, c *gin.Context)

func OkWithDetailed

func OkWithDetailed(data interface{}, message string, c *gin.Context)

func OkWithMessage

func OkWithMessage(message string, c *gin.Context)

func ResultFail

func ResultFail(code int, data interface{}, msg string, c *gin.Context)

func ResultOk

func ResultOk(code int, data interface{}, msg string, c *gin.Context)

Types

type PageResult

type PageResult struct {
	Data  interface{} `json:"data"`
	Total int64       `json:"total"`
	Page  int         `json:"page"`
	Size  int         `json:"pageSize"`
}

type Response

type Response struct {
	Code   int         `json:"errCode"`
	Data   interface{} `json:"data"`
	Msg    string      `json:"msg"`
	ErrMsg string      `json:"errMsg"`
}

Jump to

Keyboard shortcuts

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