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:
CoderAlim 2023-11-28 04:56:26 -06:00 committed by GitHub
parent 3207ad6033
commit c683b81e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))