1
This commit is contained in:
@@ -53,6 +53,7 @@ func DeSerializeData(strValue string, dataPtr interface{}) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// mapData 参数 obj 对象
|
||||
// todo 这里看是否需要将key值转换成标准格式(即字母大写),因为beego orm不区分,不转换也可以
|
||||
func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, objPtr interface{}, excludedFields []string, isCheckValue bool) (valid map[string]interface{}, invalid map[string]interface{}) {
|
||||
excludedMap := make(map[string]int)
|
||||
@@ -66,6 +67,8 @@ func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, ob
|
||||
if m[k] != nil && excludedMap[k] == 0 /*&& v != nil*/ && (!isCheckValue || !IsValueEqual(m[k], v)) {
|
||||
valid[k] = v
|
||||
m[k] = v
|
||||
globals.SugarLogger.Debugf("m[k]====%s", utils.Format4Output(m[k], false))
|
||||
globals.SugarLogger.Debugf("valid[k] ====%s", utils.Format4Output(valid[k], false))
|
||||
} else {
|
||||
invalid[k] = v
|
||||
}
|
||||
@@ -75,6 +78,9 @@ func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, ob
|
||||
globals.SugarLogger.Warnf("FilterMapByStructObject failed with err:%v, mapData:%s", err, utils.Format4Output(mapData, true))
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("m[valid]====%s", utils.Format4Output(valid, false))
|
||||
globals.SugarLogger.Debugf("m[invalid]====%s", utils.Format4Output(invalid, false))
|
||||
|
||||
return valid, invalid
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user