Fetch the repository succeeded.
package xconsole
import "errors"
// 推送任务到路由接口中
//
// rou 执行的命令
// fun 执行的命令内容
func Push(rou string, fun Command) error {
if _, ok := _default.r[rou]; ok {
return errors.New("命令 " + rou + " 已存在")
}
_default.Lock()
defer _default.Unlock()
_default.r[rou] = fun
return nil
}
// 要移除的命令列表
func UnPush(rou []string) error {
_default.Lock()
defer _default.Unlock()
for i := 0; i < len(rou); i++ {
delete(_default.r, rou[i])
}
return nil
}
// 批量推送任务到路由接口中
//
// m map结构的任务键值对
func PushMap(m map[string]Command) error {
_default.Lock()
defer _default.Unlock()
for k, v := range m {
if _, ok := _default.r[k]; ok {
return errors.New("命令 " + k + " 已存在")
}
_default.r[k] = v
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。