1 Star 0 Fork 0

leminewx/gov2x

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
command.go 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
wenxian 提交于 2024-08-30 17:56 . 0.0.6.0: optmized om
package om
type Command string
const (
CMD_GET Command = "get"
CMD_SET Command = "set"
CMD_ADD Command = "add"
CMD_DELETE Command = "delete"
CMD_REBOOT Command = "reboot"
CMD_FACTORY Command = "factory_reboot"
CMD_DOWNLOAD Command = "download"
CMD_UPLOAD Command = "upload"
CMD_RESET Command = "reset"
CMD_INFORM Command = "inform"
CMD_RELOAD_SN Command = "snReload"
)
func (own Command) IsLegal() bool {
switch own {
case CMD_GET, CMD_SET, CMD_ADD, CMD_DELETE, CMD_REBOOT, CMD_UPLOAD, CMD_DOWNLOAD, CMD_FACTORY, CMD_RESET, CMD_INFORM, CMD_RELOAD_SN:
return true
default:
return false
}
}
func (own Command) IsMatchClass(cls Class) bool {
switch own {
case CMD_GET:
if cls == CLS_VALUE || cls == CLS_OBJECT || cls == CLS_NOTIFICATION {
return true
}
case CMD_SET:
if cls == CLS_VALUE || cls == CLS_CERTIFICATE {
return true
}
case CMD_ADD:
if cls == CLS_OBJECT {
return true
}
case CMD_DELETE:
if cls == CLS_OBJECT {
return true
}
case CMD_RESET:
if cls == CLS_MODULE {
return true
}
case CMD_INFORM, CMD_REBOOT, CMD_FACTORY, CMD_DOWNLOAD, CMD_UPLOAD, CMD_RELOAD_SN:
if cls == CLS_NONE {
return true
}
}
return false
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/leminewx/gov2x.git
git@gitee.com:leminewx/gov2x.git
leminewx
gov2x
gov2x
720534f10467

搜索帮助