Compare commits

..

No commits in common. "5a2df69ffe6bf05279dbd9328667bca5893021c0" and "a87a97b0e8d48ea643998e0aaab1eaca9a6ba5d5" have entirely different histories.

2 changed files with 0 additions and 27 deletions

View File

@ -41,6 +41,4 @@ type EasyMap interface {
ToStruct(receiver interface{}) error
// ToString 转为字符串
ToString() string
// Filter 过滤数据
Filter(ignoreFieldList []string, rewriteFieldTable map[string]interface{}) map[string]interface{}
}

View File

@ -374,28 +374,3 @@ func (c *common) ToString() string {
mapData := c.GetAllForMapKeyString()
return serialize.JSON.MarshalForString(mapData)
}
// Filter 对数据进行过滤
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:25 2024/3/8
func (c *common) Filter(ignoreFieldList []string, rewriteFieldTable map[string]string) map[string]interface{} {
result := make(map[string]interface{})
ignoreFieldTable := make(map[string]bool)
for _, item := range ignoreFieldList {
ignoreFieldTable[item] = true
}
data := c.GetAllForMapKeyString()
for field, val := range data {
if _, exist := ignoreFieldTable[field]; exist {
// 忽略当前字段
continue
}
if rewriteField, exist := rewriteFieldTable[field]; exist && len(rewriteField) > 0 {
field = rewriteField
}
result[field] = val
}
return result
}