reply

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SuccT          = &T{Code: SuccErrCode, Msg: ErrCodeMsg[SuccErrCode], Data: nil}             // 操作成功
	FailT          = &T{Code: FailErrCode, Msg: ErrCodeMsg[FailErrCode], Data: nil}             // 操作失败
	InternalErrT   = &T{Code: InternalErrCode, Msg: ErrCodeMsg[InternalErrCode], Data: nil}     // 内部错误
	ParamErrT      = &T{Code: ParamErrCode, Msg: ErrCodeMsg[ParamErrCode], Data: nil}           // 参数错误
	AuthErrT       = &T{Code: AuthErrCode, Msg: ErrCodeMsg[AuthErrCode], Data: nil}             // 认证失败
	PermErrT       = &T{Code: PermErrCode, Msg: ErrCodeMsg[PermErrCode], Data: nil}             // 无权限
	ExistErrT      = &T{Code: ExistErrCode, Msg: ErrCodeMsg[ExistErrCode], Data: nil}           // 数据已存在
	NotFoundErrT   = &T{Code: NotFoundErrCode, Msg: ErrCodeMsg[NotFoundErrCode], Data: nil}     // 数据未找到
	LimitErrT      = &T{Code: LimitErrCode, Msg: ErrCodeMsg[LimitErrCode], Data: nil}           // 已限制操作
	TimeoutErrT    = &T{Code: TimeoutErrCode, Msg: ErrCodeMsg[TimeoutErrCode], Data: nil}       // 超时错误
	OtherErrT      = &T{Code: OtherErrCode, Msg: ErrCodeMsg[OtherErrCode], Data: nil}           // 未知错误
	MethodErrT     = &T{Code: MethodErrCode, Msg: ErrCodeMsg[MethodErrCode], Data: nil}         // 方法错误
	TooManyReqErrT = &T{Code: TooManyReqErrCode, Msg: ErrCodeMsg[TooManyReqErrCode], Data: nil} // 请求频繁
	FileFormatErrT = &T{Code: FileFormatErrCode, Msg: ErrCodeMsg[FileFormatErrCode], Data: nil} // 文件格式错误
	EqualErrT      = &T{Code: EqualErrCode, Msg: ErrCodeMsg[EqualErrCode], Data: nil}           // 与原数据一致
	VersionErrT    = &T{Code: VersionErrCode, Msg: ErrCodeMsg[VersionErrCode], Data: nil}       // 版本错误
)
View Source
var ErrCodeMsg = map[RespCode]string{
	SuccErrCode:       "操作成功",
	FailErrCode:       "操作失败",
	InternalErrCode:   "内部错误",
	ParamErrCode:      "参数错误",
	AuthErrCode:       "认证失败",
	PermErrCode:       "无权限",
	ExistErrCode:      "数据已存在",
	NotFoundErrCode:   "数据未找到",
	LimitErrCode:      "已限制操作",
	TimeoutErrCode:    "超时错误",
	OtherErrCode:      "未知错误",
	MethodErrCode:     "方法错误",
	TooManyReqErrCode: "请求频繁",
	FileFormatErrCode: "文件格式错误",
	EqualErrCode:      "与原数据一致",
	VersionErrCode:    "版本错误",
}

Functions

This section is empty.

Types

type List

type List struct {
	Count int64       `json:"count"`
	List  interface{} `json:"list"`
}

type RespCode

type RespCode int
const (
	SuccErrCode RespCode = iota
	FailErrCode          // 1

	InternalErrCode   // 2
	ParamErrCode      // 3
	AuthErrCode       // 4
	PermErrCode       // 5
	ExistErrCode      // 6
	NotFoundErrCode   // 7
	LimitErrCode      // 8
	TimeoutErrCode    // 9
	OtherErrCode      // 10
	MethodErrCode     // 11
	TooManyReqErrCode // 12
	FileFormatErrCode // 13
	EqualErrCode      // 14
	VersionErrCode    // 15
)

type T

type T struct {
	Code RespCode    `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func AuthErr

func AuthErr() *T

func ExistErr

func ExistErr() *T

func Fail

func Fail() *T

func InternalErr

func InternalErr() *T

func LimitErr

func LimitErr() *T

func NotFoundErr

func NotFoundErr() *T

func OtherErr

func OtherErr() *T

func ParamErr

func ParamErr() *T

func PermErr

func PermErr() *T

func Succ

func Succ(data interface{}) *T

func TimeoutErr

func TimeoutErr() *T

func (T) Error added in v0.8.1

func (r T) Error() string

func (T) GetCode

func (r T) GetCode() RespCode

func (T) GetData

func (r T) GetData() interface{}

func (T) GetMsg

func (r T) GetMsg() string

func (T) IsSucc

func (r T) IsSucc() bool

Jump to

Keyboard shortcuts

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