Documentation ¶
Index ¶
Constants ¶
View Source
const ( SelectErrCode = 400400 // 数据查询失败 SelectEmptyErrCode = 400401 // 数据查询为空 SelectExistErrCode = 400402 // 数据已存在 UpdateErrCode = 400403 // 数据更新失败 DeleteErrCode = 400404 // 数据删除失败 CreateErrCode = 400405 // 数据存储失败 ReqSendErrCode = 400406 // 请求失败 ExportModelDataErrCode = 400407 // 导出模型错误 ImportModelDataErrCode = 400408 // 导入模型错误 )
数据操作类Code
View Source
const ( ParamCheckErrCode = 400200 // 参数检验失败 ParamParseErrCode = 400202 // 参数解析失败 )
参数校验类Code
View Source
const ( AuthFailCode = 400100 // 认证失败 AuthErrCode = 400110 // 租户用户权限验证失败 )
AuthFailCode 用户响应类Code
Variables ¶
View Source
var ( AuthFailedErr = &ConstErr{ErrStr: "认证失败", ErrCode: AuthFailCode} AuditFailedErr = &ConstErr{ErrStr: "审计信息落库失败", ErrCode: AuthFailCode} )
Functions ¶
func SqlCrudErrIgnoreRecordNotFound ¶
func SqlCrudErrIgnoreRecordNotFound(err error, _ ...interface{})
SqlCrudErrIgnoreRecordNotFound mysql增删改查Err处理
Types ¶
type ConstErr ¶
type ConstErr struct { ErrStr string // Error消息 ErrCode int // Error状态码 ErrComment string // Error详细描述 }
ConstErr 自定义Error
type ErrorResult ¶
type ErrorResult struct {
// contains filtered or unexported fields
}
ErrorResult Err消化器(不要在意名字)
func (*ErrorResult) Process ¶
func (er *ErrorResult) Process(ef ...func(err error, data ...interface{}))
Process 如果Result捕获到了Err,就是用自定义的Err来处理
func (*ErrorResult) Unwrap ¶
func (er *ErrorResult) Unwrap() interface{}
Unwrap 自动处理Error, 比较暴躁, 直接panic, 让中间件去兜底
Click to show internal directories.
Click to hide internal directories.