(fix) fix convert `null` value
This commit is contained in:
parent
95083deaa6
commit
d8fdeb1483
|
@ -237,9 +237,6 @@ func (statement *Statement) Value2Interface(col *schemas.Column, fieldValue refl
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if fieldValue.Interface() == nil && statement.dialect.URI().DBType == schemas.YDB {
|
|
||||||
return (*string)(nil), nil
|
|
||||||
}
|
|
||||||
return fieldValue.Interface(), nil
|
return fieldValue.Interface(), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ type NullStruct struct {
|
||||||
Age sql.NullInt64
|
Age sql.NullInt64
|
||||||
Height sql.NullFloat64
|
Height sql.NullFloat64
|
||||||
IsMan sql.NullBool `xorm:"null"`
|
IsMan sql.NullBool `xorm:"null"`
|
||||||
Nil driver.Valuer
|
|
||||||
CustomStruct CustomStruct `xorm:"VARCHAR null"`
|
CustomStruct CustomStruct `xorm:"VARCHAR null"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@ func TestNullStructInsert(t *testing.T) {
|
||||||
Height: sql.NullFloat64{Float64: 1.5 + 1.1*float64(i), Valid: true},
|
Height: sql.NullFloat64{Float64: 1.5 + 1.1*float64(i), Valid: true},
|
||||||
IsMan: sql.NullBool{Bool: true, Valid: true},
|
IsMan: sql.NullBool{Bool: true, Valid: true},
|
||||||
CustomStruct: CustomStruct{int64(i), int64(i + 1), int64(i + 2)},
|
CustomStruct: CustomStruct{int64(i), int64(i + 1), int64(i + 2)},
|
||||||
Nil: nil,
|
|
||||||
}
|
}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue