Documentation
¶
Index ¶
- Variables
- func NewError(ctx context.Context, code int, v ...interface{}) error
- func NewErrorWithStatus(ctx context.Context, status int, code int, v ...interface{}) error
- func NewForbiddenError(ctx context.Context, code int, v ...interface{}) error
- func NewInternalError(ctx context.Context, code int, v ...interface{}) error
- func NewNotFoundError(ctx context.Context, code int, v ...interface{}) error
- func NewUnauthorizedError(ctx context.Context, code int, v ...interface{}) error
- func Register(lang string, code map[int]string)
- func T(ctx context.Context, key int, args ...interface{}) string
- func WithLanguage(ctx context.Context, lang string) context.Context
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLang = "zh-cn"
Functions ¶
func NewErrorWithStatus ¶
NewErrorWithStatus 自定义错误
func NewForbiddenError ¶
NewForbiddenError 403禁止访问
func NewInternalError ¶
NewInternalError 500构造内部错误
func NewNotFoundError ¶
NewNotFoundError 404资源不存在
func NewUnauthorizedError ¶
NewUnauthorizedError 401未授权
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.