diff --git a/scan.go b/scan.go index e82e3f07..c4f88cf8 100644 --- a/scan.go +++ b/scan.go @@ -238,6 +238,8 @@ func Scan(rows *sql.Rows, db *DB, initialized bool) { } } } + default: + db.AddError(rows.Scan(dest)) } } diff --git a/tests/scan_test.go b/tests/scan_test.go index 86cb0399..67d5f385 100644 --- a/tests/scan_test.go +++ b/tests/scan_test.go @@ -63,6 +63,13 @@ func TestScan(t *testing.T) { if len(results) != 2 || results[0].Name != user2.Name || results[1].Name != user3.Name { t.Errorf("Scan into struct map, got %#v", results) } + + type ID uint64 + var id ID + DB.Raw("select id from users where id = ?", user2.ID).Scan(&id) + if uint(id) != user2.ID { + t.Errorf("Failed to scan to customized data type") + } } func TestScanRows(t *testing.T) {