time zero check
判断time是否为空(如果空,就不更新) time字段,在更新的时候,不管是否获取最新事件,都会去更新表;这里加入判空,如果为空,就不更新该字段
This commit is contained in:
parent
59408390c2
commit
f93c350e93
5
utils.go
5
utils.go
@ -139,6 +139,11 @@ func isBlank(value reflect.Value) bool {
|
||||
return value.Float() == 0
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
return value.IsNil()
|
||||
case reflect.Struct://time zero check;
|
||||
v,ok:= value.Interface().(time.Time)
|
||||
if ok {
|
||||
return !v.IsZero()
|
||||
}
|
||||
}
|
||||
|
||||
return reflect.DeepEqual(value.Interface(), reflect.Zero(value.Type()).Interface())
|
||||
|
Loading…
x
Reference in New Issue
Block a user