def

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 2 Imported by: 52

Documentation

Index

Constants

View Source
const (
	Success = iota
	// UnKnownError 未知错误
	UnKnownError
	// NotFound 未找到
	NotFound
	// InvalidParam 无效参数
	InvalidParameter
	// IllegalParam 非法参数
	IllegalParam
	// InvalidAuthority 非法授权
	InvalidAuthority
	// Unexpected 意外错误
	Unexpected
	// Duplicated 重复
	Duplicated
	// DatabaseError 数据库错误
	DatabaseError
	// Timeout 超时
	Timeout
	// NetworkError 网络错误
	NetworkError
	// Unauthorized 未授权
	Unauthorized
	// Forbidden 禁止访问
	Forbidden
	// ResourceExhausted 资源耗尽
	ResourceExhausted
	// TooManyRequests 请求过多
	TooManyRequests
	// ServiceUnavailable 服务不可用
	ServiceUnavailable
	// NotImplemented 未实现
	NotImplemented
	// BadGateway 网关错误
	BadGateway
	// DataCorrupted 数据损坏
	DataCorrupted
	// VersionConflict 版本冲突
	VersionConflict
	// ExternalServiceError 外部服务错误
	ExternalServiceError
	// InvalidOperation 无效操作
	InvalidOperation
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Code added in v1.4.0

type Code int

type CommonResult added in v1.3.29

type CommonResult struct {
	Result
	Value json.RawMessage `json:"value"`
}

type CommonSliceResult added in v1.3.29

type CommonSliceResult struct {
	Result
	Total int64           `json:"total"`
	Value json.RawMessage `json:"values"`
}

type Error added in v1.4.0

type Error struct {
	Code    Code   `json:"code"`
	Message string `json:"message"`
}

func NewError added in v1.3.36

func NewError(errorCode Code, errorMessage string) *Error

func (Error) Error added in v1.4.0

func (e Error) Error() string

type Result

type Result struct {
	Error *Error `json:"error"`
}

func NewResult added in v1.4.0

func NewResult() *Result

func (*Result) Fail

func (s *Result) Fail() bool

Fail 失败

func (*Result) Success

func (s *Result) Success() bool

Success 成功

Jump to

Keyboard shortcuts

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