1 Star 1 Fork 0

fast_api/api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
types.go 376 Bytes
一键复制 编辑 原始数据 按行查看 历史
t.io 提交于 2023-09-03 08:44 +08:00 . use context replace mg
package utils
import (
"sync"
)
type Map[K string, V any] struct {
kv sync.Map
}
func (m *Map[K, V]) Get(name K) (v1 V) {
if v, b := m.kv.Load(name); b {
v1 = v.(V)
}
return
}
func (m *Map[K, V]) Set(name K, v V) {
m.kv.Store(name, v)
}
func (m *Map[K, V]) Range(f func(K, V)) {
m.kv.Range(func(key, value any) bool {
f(key.(K), value.(V))
return true
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fast_api/api.git
git@gitee.com:fast_api/api.git
fast_api
api
api
v0.1.0

搜索帮助