constants

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNone                      = CodeType(0)      //没有错误,占位
	ErrRequestParamsInvalid      = CodeType(100000) //请求参数有误
	ErrAuthorizationTokenInvalid = CodeType(100001) //令牌已失效
	ErrInternalSeverError        = CodeType(999999) //服务器内部错误
)

错误码

View Source
const (
	PublicKeyBeginStr  = "-----BEGIN PUBLIC KEY-----"  //公钥开始标识符
	PublicKeyEndStr    = "-----END PUBLIC KEY-----"    //公钥结束标识符
	PrivateKeyBeginStr = "-----BEGIN PRIVATE KEY-----" //私钥开始标识符
	PrivateKeyEndStr   = "-----END PRIVATE KEY-----"   //私钥结束标识符
)
View Source
const (
	Success bool = true  //Success 业务状态码:成功
	Failure bool = false //Failure 业务状态码:失败
)
View Source
const DefaultTimeZone string = "Asia/Shanghai"

DefaultTimeZone 默认时区

Variables

This section is empty.

Functions

func RegisterCode

func RegisterCode(code CodeType, msg string)

RegisterCode 注册常量代码

当code码重复时,后者覆盖前者

Types

type CodeType

type CodeType int

CodeType 错误码类型

func (CodeType) Int

func (ct CodeType) Int() int

Int 获取错误码

func (CodeType) String

func (ct CodeType) String() string

String 获取错误信息字符

type ICodeType

type ICodeType interface {
	String() string
	Int() int
}

ICodeType 错误码类型接口

Jump to

Keyboard shortcuts

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