map增加迭代实现

This commit is contained in:
2023-03-07 17:34:02 +08:00
parent 7c1d72f0de
commit 8e29a6318f
6 changed files with 71 additions and 0 deletions

View File

@ -286,3 +286,19 @@ func (n *normal) GetAllForMapKeyString() map[string]interface{} {
}
return finalData
}
// Iterator ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:32 2023/3/7
func (n *normal) Iterator(handleFunc IteratorFunc) {
if nil == handleFunc {
return
}
n.RLock()
defer n.RUnlock()
for key, val := range n.data {
handleFunc(key, val)
}
}