errno

package
v0.0.0-...-20002e4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success             = NewErrNo(int64(errno.Err_Success), "Success")
	BadRequest          = NewErrNo(int64(errno.Err_BadRequest), "Request Failed")
	GenerateTokenFail   = NewErrNo(int64(errno.Err_GenerateTokenFail), "Generate token failed")
	RequestServerFail   = NewErrNo(int64(errno.Err_RequestServerFail), "Request server failed")
	BindAndValidateFail = NewErrNo(int64(errno.Err_BindAndValidateFail), "Bind and validate failed")
	ParamErr            = NewErrNo(int64(errno.Err_ParamErr), "Param error")
	AuthorizeFail       = NewErrNo(int64(errno.Err_AuthorizeFail), "Authorize failed")
)

Functions

func SendResponse

func SendResponse(c *app.RequestContext, err ErrNo, data interface{})

SendResponse pack response.

Types

type ErrNo

type ErrNo struct {
	ErrCode int64
	ErrMsg  string
}

func NewErrNo

func NewErrNo(code int64, msg string) ErrNo

NewErrNo return ErrNo.

func (ErrNo) Error

func (e ErrNo) Error() string

func (ErrNo) WithMessage

func (e ErrNo) WithMessage(msg string) ErrNo

type Response

type Response struct {
	Code    int64       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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