1 Star 1 Fork 0

linngc / center.gf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
enums_gcode_status.go 1.84 KB
一键复制 编辑 原始数据 按行查看 历史
linngc 提交于 2023-07-16 15:54 . add:cachebuffer扩展中添加internal包
// Package enums
// @Link https://gitee.com/linngc/center.gf
// @Copyright Copyright (c) 2022 center CLI
// @Author linngc
// @License
package enums
import (
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/frame/g"
)
type cGcodeStatus struct {
}
var (
insGcodeStatus = cGcodeStatus{}
)
var gcodeStatusText = map[gcode.Code]string{
gcode.CodeOK: "成功",
gcode.CodeNil: "未指定错误代码",
gcode.CodeInternalError: "网络错误",
gcode.CodeValidationFailed: "验证错误",
gcode.CodeDbOperationError: "数据库操作失败",
gcode.CodeInvalidOperation: "函数验证错误",
gcode.CodeInvalidParameter: "无效参数",
gcode.CodeMissingParameter: "缺少当前操作的参数",
gcode.CodeInvalidConfiguration: "配置操作错误",
gcode.CodeMissingConfiguration: "当前操作缺少配置",
gcode.CodeNotImplemented: "操作尚未实施",
gcode.CodeNotSupported: "尚不支持该操作",
gcode.CodeOperationFailed: "请检查重试",
gcode.CodeNotAuthorized: "无权限,鉴权出错",
gcode.CodeSecurityReason: "安全校验问题",
gcode.CodeServerBusy: "服务器正忙,请稍后再试",
gcode.CodeUnknown: "未知错误",
gcode.CodeNotFound: "未找到",
gcode.CodeInvalidRequest: "无效请求",
gcode.CodeBusinessValidationFailed: "业务验证失败",
}
func GcodeStatus() *cGcodeStatus {
return &insGcodeStatus
}
func (c *cGcodeStatus) Text(code gcode.Code) string {
str, ok := gcodeStatusText[code]
if !ok {
return ""
}
return str
}
func (c *cGcodeStatus) Enum() g.MapIntStr {
result := g.MapIntStr{}
for code, _ := range gcodeStatusText {
result[code.Code()] = code.Message()
}
return result
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/linngc/center.gf.git
git@gitee.com:linngc/center.gf.git
linngc
center.gf
center.gf
v0.2.12

搜索帮助

344bd9b3 5694891 D2dac590 5694891