code

package
v0.0.0-...-6bf0a34 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Success                   = NewError(1, "成功")
	Success = NewSuss(1, "成功")

	ErrorNotFoundAPI      = NewError(incr(404), "找不到API")
	ErrorInvalidParams    = NewError(incr(404), "缺少请求参数")
	ErrorTooManyRequests  = NewError(incr(404), "请求过多")
	ErrorInvalidAuthToken = NewError(incr(404), "验证授权Token失败")
	ErrorInvalidToken     = NewError(incr(404), "缺少用户凭证Token")

	ErrorServerInternal = NewError(incr(500), "服务内部错误")
)
View Source
var (
	ErrorUploadFileFail = NewError(incr(600), "上传文件失败")
)

Functions

This section is empty.

Types

type Code

type Code struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(code int, msg string) *Code

func NewSuss

func NewSuss(code int, msg string) *Code

func (*Code) Code

func (e *Code) Code() int

func (*Code) Data

func (e *Code) Data() interface{}

func (*Code) Details

func (e *Code) Details() []string

func (*Code) Error

func (e *Code) Error() string

func (*Code) HaveDetails

func (e *Code) HaveDetails() bool

func (*Code) Msg

func (e *Code) Msg() string

func (*Code) Msgf

func (e *Code) Msgf(args []interface{}) string

func (*Code) Status

func (e *Code) Status() bool

func (*Code) StatusCode

func (e *Code) StatusCode() int

func (*Code) WithData

func (e *Code) WithData(data interface{}) *Code

func (*Code) WithDetails

func (e *Code) WithDetails(details ...string) *Code

Jump to

Keyboard shortcuts

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