message

package
v0.0.5-beta2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorDBDelete = Error{
	Code: 110104,
	Msg:  "删除错误",
}
View Source
var ErrorDBFound = Error{
	Code: 110106,
	Msg:  "记录已存在",
}
View Source
var ErrorDBInsert = Error{
	Code: 110102,
	Msg:  "新建错误",
}
View Source
var ErrorDBNotFound = Error{
	Code: 110105,
	Msg:  "记录不存在",
}
View Source
var ErrorDBQuery = Error{
	Code: 110101,
	Msg:  "查询错误",
}
View Source
var ErrorDBUpdate = Error{
	Code: 110103,
	Msg:  "更新错误",
}
View Source
var ErrorGinTimeoutError = Error{
	Code: 100003,
	Msg:  "Gin timeout error",
}
View Source
var ErrorJsonMarshalError = Error{
	Code: 100004,
	Msg:  "json marshal error",
}
View Source
var ErrorJsonUnMarshalError = Error{
	Code: 100005,
	Msg:  "json unmarshal error",
}
View Source
var ErrorParamInvalid = Error{
	Code: 100001,
	Msg:  "param error",
}
View Source
var ErrorSysInnerError = Error{
	Code: 100002,
	Msg:  "system inner error",
}

Functions

func Failed

func Failed(c *gin.Context, err error)

func FailedWithMsg

func FailedWithMsg(c *gin.Context, msg string, err error)

func HTTP400

func HTTP400(ctx *gin.Context, err error)

func HTTP403

func HTTP403(ctx *gin.Context, err error)

func HTTP404

func HTTP404(ctx *gin.Context, err error)

func HTTP500

func HTTP500(ctx *gin.Context, err error)

func HTTPFail

func HTTPFail(ctx *gin.Context, err error)

func HTTPFailWithData

func HTTPFailWithData(ctx *gin.Context, err error, data interface{})

HTTPFailWithData 业务失败带Data

func HTTPFailWithStatus

func HTTPFailWithStatus(ctx *gin.Context, err error, httpStatus int)

func HTTPOutsideSuccessWithData

func HTTPOutsideSuccessWithData(ctx *gin.Context, data interface{})

func HTTPSuccess

func HTTPSuccess(ctx *gin.Context)

HTTPSuccess 业务成功

func HTTPSuccessWithData

func HTTPSuccessWithData(ctx *gin.Context, data interface{})

HTTPSuccessWithData 业务成功返回

func HTTPSuccessWithSting

func HTTPSuccessWithSting(ctx *gin.Context, data string)

func SetErrPrintfMsg

func SetErrPrintfMsg(err *Error, v ...interface{})

func Success

func Success(c *gin.Context, data interface{})

func SuccessWithMsg

func SuccessWithMsg(c *gin.Context, msg string, data interface{})

func WriteResponse

func WriteResponse(c *gin.Context, err error, data interface{})

Types

type Error

type Error struct {
	Code int           `json:"-"`
	Msg  string        `json:"msg"`
	Args []interface{} `json:"-"`
}

func NewBaseError

func NewBaseError(code int, message string, args ...interface{}) *Error

func NewError

func NewError(code int, message, userMsg string) Error

func NewMessageError

func NewMessageError(message string) Error

func (Error) Equal

func (err Error) Equal(e error) bool

func (Error) Error

func (err Error) Error() string

func (Error) Sprintf

func (err Error) Sprintf(v ...interface{}) Error

func (Error) WithArgs

func (err Error) WithArgs(args ...interface{}) Error

func (Error) Wrap

func (err Error) Wrap(core error) error

func (Error) WrapPrint

func (err Error) WrapPrint(core error, message string, user ...interface{}) error

func (Error) WrapPrintf

func (err Error) WrapPrintf(core error, format string, message ...interface{}) error

type HTTPRes

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

type Response

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

Jump to

Keyboard shortcuts

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