reply

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 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}
)
View Source
var ErrCodeMsg = map[RespCode]string{
	SuccErrCode:     "ok",
	FailErrCode:     "操作失败",
	InternalErrCode: "内部错误",
	ParamErrCode:    "参数错误",
	AuthErrCode:     "认证失败",
	PermErrCode:     "无权限",
	ExistErrCode:    "数据已存在",
	NotFoundErrCode: "数据未找到",
	LimitErrCode:    "已限制操作",
	TimeoutErrCode:  "超时错误",
	OtherErrCode:    "未知错误",
	MethodErrCode:   "方法错误",
}

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
)

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) 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