constant

package
v0.0.0-...-ac3b76c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvKey    = "app.env"
	EnvOnline = "release"
	EnvDev    = "dev"
	EnvTest   = "test"

	UserName = "user"
)
View Source
const (
	HttpProtocol  = "http://"
	HttpsProtocol = "https://"
)

http协议

View Source
const (
	ClientTypePc     = "pc"
	ClientTypeMobile = "mobile"
)

客户端类型

View Source
const (
	ListPageSize    = 10
	ListCurrentPage = 1
)

列表分页数据默认值

View Source
const (
	Success            = 0
	Fail               = 1
	ErrorHaveNoAccess  = 2
	ErrorUnmarshalJSON = 3
	ErrorMarshalJSON   = 4
	ErrorDB            = 5
	ErrorNotLogin      = 6
	ErrorJWT           = 7
	ErrorEtcd          = 8

	// ErrorParams 参数错误
	ErrorParams = 400
	// ErrorAuthFail 相关业务逻辑校验失败
	ErrorAuthFail = 401
	// ErrorForbidden 权限不足
	ErrorForbidden = 403
	// ErrorNotFound 资源不存在
	ErrorNotFound = 404
	// ErrorInternetServer 代码错误
	ErrorInternetServer = 500
	// ErrorBadGateway 上游服务返回的内容无法识别
	ErrorBadGateway = 502
	// ErrorServiceUnavailable 上游服务暂时不可用
	ErrorServiceUnavailable = 503
	// ErrorGatewayTimeout 上游服务超时
	ErrorGatewayTimeout = 504
	// ErrorDBRecordExist 记录已存在
	ErrorDBRecordExist = 200101
	// ErrorUploadImage 文件上传错误
	ErrorUploadImage = 200201

	// ErrorCreateContainer 创建容器错误
	ErrorCreateContainer = 300101
	// ErrorContainerList 获取容器列表错误
	ErrorContainerList = 300102
	// ErrorContainerLogs 获取容器日志错误
	ErrorContainerLogs = 300103
	// ErrorContainerStop 停止容器错误
	ErrorContainerStop = 300104
)
View Source
const ActivityTimeError = 10008
View Source
const (
	CloudNative = "cloud_native"
)
View Source
const ErrorBadReferrer = 10005
View Source
const ErrorDownloadNodata = 10006
View Source
const ErrorInvalidParams = 10001

常见错误

View Source
const ErrorMarshal = 10002
View Source
const ErrorNeedLogin = 10004
View Source
const ErrorProtobufNodata = 10003
View Source
const ErrorRedis = 10013
View Source
const ErrorRequestTooOften = -2

请求太过频繁

View Source
const ErrorSomethingWrong = 10007
View Source
const ErrorUnknow = -1

未知错误

View Source
const RT_AJAX = 1

设置数据返回类型

View Source
const RT_DOWNLOAD = 3
View Source
const RT_ORIGINAL = 4
View Source
const RT_PROTO = 2
View Source
const (
	UploadFileMaxSize int64 = 20 << 20
)

UploadFileMaxSize 上传文件的最大限制

Variables

View Source
var ErrorMsg = map[int]string{
	Success:              "success",
	Fail:                 "fail",
	ErrorHaveNoAccess:    "have no access",
	ErrorParams:          "request params err",
	ErrorUnmarshalJSON:   "unmarshal json failed",
	ErrorMarshalJSON:     "marshal json failed",
	ErrorDB:              "db failed",
	ErrorNotLogin:        "need login",
	ErrorUploadImage:     "upload image failed",
	ErrorJWT:             "generate token failed",
	ErrorDBRecordExist:   "db record is exist",
	ErrorCreateContainer: "create container failed",
	ErrorContainerList:   "get container list failed",
	ErrorContainerLogs:   "get container ID %s logs failed",
	ErrorContainerStop:   "stop container ID %s failed",
	ErrorEtcd:            "etcd service failed",
}

Functions

This section is empty.

Types

type Error

type Error struct {
	ErrCode int    `json:"errCode"`
	ErrMsg  string `json:"errMsg"`
}

Jump to

Keyboard shortcuts

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