Skip to content

Commit 009eb56

Browse files
Merge pull request #111 from oracle-samples/nullable-boolean
Correctly handle nil pointer values for nullable columns
2 parents fea03f8 + 6db4177 commit 009eb56

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

oracle/common.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ func convertValue(val interface{}) interface{} {
218218

219219
// Dereference pointers
220220
rv := reflect.ValueOf(val)
221+
if rv.Kind() == reflect.Ptr && rv.IsNil() {
222+
return nil
223+
}
224+
221225
for rv.Kind() == reflect.Ptr && !rv.IsNil() {
222226
rv = rv.Elem()
223227
val = rv.Interface()

tests/boolean_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,8 @@ func TestBooleanStringCoercion(t *testing.T) {
259259
}
260260
}
261261

262-
263262
func TestBooleanNullableColumn(t *testing.T) {
264-
t.Skip("Skipping until nullable bool bug is resolved")
263+
// t.Skip("Skipping until nullable bool bug is resolved")
265264
DB.Migrator().DropTable(&BooleanTest{})
266265
DB.AutoMigrate(&BooleanTest{})
267266

0 commit comments

Comments
 (0)