response

package
v0.0.0-...-17b6be2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CodeFacadeErr 通用系统内部错误
	CodeFacadeErr = 30000
)
View Source
const (
	CodeOK = 0
)
View Source
const (
	// CodeSystemErr 通用系统内部错误
	CodeSystemErr = 10000
)

Variables

View Source
var (
	// CodeUserErr 通用用户错误
	CodeUserErr         = 20000
	CodeErrUnauthorized = 20401
	CodeErrBadRequest   = 20400
	CodeErrNotFound     = 20404
)

Functions

This section is empty.

Types

type Resp

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

Resp Code 定义:错误产生来源+四位数字编号(业务定义),返回0表示成功 Code 1: 用户错误,2: 系统错误,3: 调用第三方系统错误

func Data

func Data(data interface{}) *Resp

func Error

func Error(err error) *Resp

func ErrorBadRequest

func ErrorBadRequest() *Resp

func ErrorBadRequestWithMsg

func ErrorBadRequestWithMsg(msg string) *Resp

func ErrorNotFound

func ErrorNotFound() *Resp

func ErrorUnauthorized

func ErrorUnauthorized() *Resp

func FacadeError

func FacadeError(msg string) *Resp

func Fail

func Fail() *Resp

func OK

func OK() *Resp

func Status

func Status(ok bool) *Resp

func SysError

func SysError(msg string) *Resp

func UserError

func UserError(msg string) *Resp

Jump to

Keyboard shortcuts

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