- no platform dependency in sync.go
This commit is contained in:
@@ -30,16 +30,6 @@ func NormalMakeMapByFieldList(mapData map[string]interface{}, fields []string, u
|
||||
return retVal
|
||||
}
|
||||
|
||||
func checkAndGetStructValue(item interface{}) *reflect.Value {
|
||||
value := reflect.ValueOf(item)
|
||||
if value.Kind() == reflect.Ptr {
|
||||
value = value.Elem()
|
||||
} else {
|
||||
panic("item ust be ptr type")
|
||||
}
|
||||
return &value
|
||||
}
|
||||
|
||||
func WrapAddIDCULEntity(item interface{}, lastOperator string) interface{} {
|
||||
now := time.Now()
|
||||
if mapData, ok := item.(map[string]interface{}); ok {
|
||||
@@ -48,7 +38,7 @@ func WrapAddIDCULEntity(item interface{}, lastOperator string) interface{} {
|
||||
mapData[model.FieldUpdatedAt] = now
|
||||
mapData[model.FieldLastOperator] = lastOperator
|
||||
} else {
|
||||
value := checkAndGetStructValue(item)
|
||||
value := jxutils.CheckAndGetStructValue(item)
|
||||
nowValue := reflect.ValueOf(now)
|
||||
value.FieldByName(model.FieldID).SetInt(0)
|
||||
value.FieldByName(model.FieldCreatedAt).Set(nowValue)
|
||||
@@ -62,7 +52,7 @@ func WrapAddIDCULDEntity(item interface{}, lastOperator string) interface{} {
|
||||
if mapData, ok := item.(map[string]interface{}); ok {
|
||||
mapData[model.FieldDeletedAt] = utils.DefaultTimeValue
|
||||
} else {
|
||||
value := checkAndGetStructValue(item)
|
||||
value := jxutils.CheckAndGetStructValue(item)
|
||||
value.FieldByName(model.FieldDeletedAt).Set(reflect.ValueOf(utils.DefaultTimeValue))
|
||||
}
|
||||
return WrapAddIDCULEntity(item, lastOperator)
|
||||
@@ -74,7 +64,7 @@ func WrapUpdateULEntity(item interface{}, lastOperator string) interface{} {
|
||||
mapData[model.FieldUpdatedAt] = now
|
||||
mapData[model.FieldLastOperator] = lastOperator
|
||||
} else {
|
||||
value := checkAndGetStructValue(item)
|
||||
value := jxutils.CheckAndGetStructValue(item)
|
||||
nowValue := reflect.ValueOf(now)
|
||||
value.FieldByName(model.FieldUpdatedAt).Set(nowValue)
|
||||
value.FieldByName(model.FieldLastOperator).SetString(lastOperator)
|
||||
|
||||
Reference in New Issue
Block a user