1 Star 0 Fork 0

linngc / central-mirror

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
enums_types.go 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
linngc 提交于 2024-04-01 16:44 . update:提取speedsdk扩张到工具包
// Package enums
// @Link https://gitee.com/linngc/central-mirror
// @Copyright Copyright (c) 2024 central-mirror CLI
// @Author linngc
// @License
package enums
import "github.com/gogf/gf/v2/text/gstr"
type CosType int //代理仓库对象存储服务类型
const (
EmbedFs CosType = iota //默认本地存储
Leveldb //本地持久化的key-value数据
Minio //minio缓存存储
Qiniu //qiniu缓存存储
Tencent //tencent缓存存储
)
// String 根据枚举对象获取key枚举字符串
func (p CosType) String() string {
switch p {
case EmbedFs:
return "embedfs"
case Leveldb:
return "leveldb"
case Minio:
return "minio"
case Qiniu:
return "qiniu"
case Tencent:
return "tencent"
default:
return "unknown"
}
}
// GetCosType 根据key枚举字符串获取枚举对象
func GetCosType(str string) CosType {
str = gstr.ToLower(str)
switch str {
case "embedfs":
return EmbedFs
case "leveldb":
return Leveldb
case "minio":
return Minio
case "qiniu":
return Qiniu
case "tencent":
return Tencent
default:
return -1
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/linngc/central-mirror.git
git@gitee.com:linngc/central-mirror.git
linngc
central-mirror
central-mirror
a6b6bab2d6e5

搜索帮助

344bd9b3 5694891 D2dac590 5694891