fix error time (previes wrong time) when select multiple nullable time using type time.Time
When the column type allows for optional datetime fields, if we set the field type as time.Time and there is a scenario where one record in the query result has this field while another does not, it may lead to the occurrence of dirty data where the field value of the second record is the same as the field value of the first record
This commit is contained in:
parent
3207ad6033
commit
c683b81e5d
@ -824,6 +824,8 @@ func (field *Field) setupValuerAndSetter() {
|
||||
case **time.Time:
|
||||
if data != nil && *data != nil {
|
||||
field.Set(ctx, value, *data)
|
||||
}else{
|
||||
field.Set(ctx, value, nil)
|
||||
}
|
||||
case time.Time:
|
||||
field.ReflectValueOf(ctx, value).Set(reflect.ValueOf(v))
|
||||
|
Loading…
x
Reference in New Issue
Block a user