Compare commits
0
Commits
No files matched your search
@@ -34,6 +34,4 @@ type EasyMap interface {
|
|||||||
Exist(key interface{}) bool
|
Exist(key interface{}) bool
|
||||||
GetAll() map[interface{}]interface{}
|
GetAll() map[interface{}]interface{}
|
||||||
GetAllForMapKeyString() map[string]interface{}
|
GetAllForMapKeyString() map[string]interface{}
|
||||||
// Iterator 对数据的迭代
|
|
||||||
Iterator(IteratorFunc)
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Package easymap ...
|
|
||||||
//
|
|
||||||
// Description : easymap ...
|
|
||||||
//
|
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
|
||||||
//
|
|
||||||
// Date : 2023-03-07 17:27
|
|
||||||
package easymap
|
|
||||||
|
|
||||||
// IteratorFunc 迭代函数
|
|
||||||
type IteratorFunc func(key interface{}, value interface{})
|
|
||||||
@@ -286,19 +286,3 @@ func (n *normal) GetAllForMapKeyString() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
return finalData
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-16
@@ -155,19 +155,3 @@ func (s *segment) GetAllForMapKeyString() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
return finalData
|
return finalData
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterator ...
|
|
||||||
//
|
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
|
||||||
//
|
|
||||||
// Date : 17:32 2023/3/7
|
|
||||||
func (s *segment) Iterator(handleFunc IteratorFunc) {
|
|
||||||
if nil == handleFunc {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for i := 0; i < s.segment; i++ {
|
|
||||||
for k, v := range s.dataTable[i].GetAll() {
|
|
||||||
handleFunc(k, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -233,18 +233,3 @@ func (s *syncMap) GetAllForMapKeyString() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
return finalData
|
return finalData
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterator 迭代数据
|
|
||||||
//
|
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
|
||||||
//
|
|
||||||
// Date : 17:27 2023/3/7
|
|
||||||
func (s *syncMap) Iterator(handleFunc IteratorFunc) {
|
|
||||||
if nil == handleFunc {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
s.data.Range(func(key, value interface{}) bool {
|
|
||||||
handleFunc(key, value)
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -136,14 +136,3 @@ func (s *segmentSync) GetAllForMapKeyString() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
return finalData
|
return finalData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *segmentSync) Iterator(handleFunc IteratorFunc) {
|
|
||||||
if nil == handleFunc {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for i := 0; i < s.segment; i++ {
|
|
||||||
for k, v := range s.dataTable[i].GetAll() {
|
|
||||||
handleFunc(k, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||