returns

package
v0.0.0-...-72d088b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissParam          = def(9000, "参数错误")
	VerificationFialed = def(9001, "校验失败")
	SystemError        = def(9002, "系统错误")

	NotLogin     = def(9100, "用户未登录")
	NoPhoneBound = def(9101, "用户未绑定手机号")
	NoPermission = def(9102, "没有权限进行操作")
)
View Source
var (
	ID       int32                           // 服务编号,从100开始,最大支持999
	Name     string                          // 服务名称,与git库,servic名称等保持一致
	Messages ErrorMessages = ErrorMessages{} // 存储所有错误定义,其中包含通用错误

)

Functions

func DefCode

func DefCode(lv ErrorLevel, code int32, message string) int32

func Init

func Init(id int32, name string) error

func NewError

func NewError(key int32) error

func ParseError

func ParseError(err error) *errors.Error

Types

type ErrorLevel

type ErrorLevel int32

错误等级

var (
	LogicErr  ErrorLevel = 1
	SystemErr ErrorLevel = 2
)

type ErrorMessages

type ErrorMessages map[int32]errors.Error

ErrorMessages 错误消息map定义表

type Reponese

type Reponese struct {
	Code    int32
	Message string
	Data    interface{}
}

Reponese 返回给端的结构体

func Error

func Error(err error, data interface{}) *Reponese

Error 失败信息包装器,给端使用才会需要,err为micro结构体error

func Success

func Success(data interface{}) *Reponese

Success 成功消息包装,给端使用才会需要

Jump to

Keyboard shortcuts

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