支持Map类型的包装 #6

Merged
zhangdeman merged 9 commits from feature/support_map into master 2024-11-19 16:31:05 +08:00
Showing only changes of commit fcaa7ee1c2 - Show all commits

31
map.go
View File

@ -44,3 +44,34 @@ func (m *Map) Exist(key string) bool {
_, exist := v[key]
return exist
}
// Value 获取数据值
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 19:39 2024/11/6
func (m *Map) Value() Map {
if nil == m {
return map[string]any{}
}
return *m
}
// Clone 克隆数据
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 19:40 2024/11/6
func (m *Map) Clone() Map {
newData := map[string]any{}
if nil == m {
return newData
}
m.rlock()
defer m.unlock()
mapValue := m.Value()
for k, v := range mapValue {
newData[k] = v
}
return newData
}