hcode

package
v0.0.0-...-50e54af Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EN = "en"
	ZH = "zh"
)
View Source
const LanguageLen = 2

LanguageLen 要支持多少种语言

Variables

View Source
var (
	OK                   = addCode(200)  // 正确
	ErrServer            = addCode(500)  // 服务器内部错误
	ErrReqLimit          = addCode(-501) // 限速
	ErrParameter         = addCode(-502) // 参数错误
	ErrInternalParameter = addCode(-503) // 内部参数错误
	ErrInternalDb        = addCode(-504) // 内部参数错误DB
	ErrInternalCache     = addCode(-505) // 内部参数错误Redis

	ErrAddressGet       = addCode(-550) // 地址获取失败
	ErrCurrencyNotFound = addCode(-551) // 币种不存在
	ErrNetNotFound      = addCode(-552) // 转账网络不存在

)

Functions

func Click

func Click()

func EqualError

func EqualError(code Codes, err error) bool

Types

type Code

type Code int

func String

func String(e string) Code

func (Code) Code

func (e Code) Code() int

func (Code) Error

func (e Code) Error() string

func (Code) Message

func (e Code) Message(lang ...string) string

type Codes

type Codes interface {
	Error() string
	Code() int
	Message(lang ...string) string
}

func Cause

func Cause(e error) Codes

Jump to

Keyboard shortcuts

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