Skip to content

Commit

Permalink
Test default behavior for other column types
Browse files Browse the repository at this point in the history
Only int64 is overridden.
  • Loading branch information
jackc committed Nov 16, 2024
1 parent 0a38201 commit 13ab724
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/database/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4282,16 +4282,22 @@ func TestRowsColumnScanner(t *testing.T) {
}
var (
str string
n int64
i64 int64
i int
f64 float64
ui uint
)
err = db.QueryRowContext(ctx, "SELECT|t|str,n|").Scan(&str, &n)
err = db.QueryRowContext(ctx, "SELECT|t|str,n,n,n,n|").Scan(&str, &i64, &i, &f64, &ui)
if err != nil {
t.Fatal("select", err)
}

list := []struct{ got, want any }{
{str, "foo"},
{n, int64(42)},
{i64, int64(42)},
{i, int(1)},
{f64, float64(1)},
{ui, uint(1)},
}

for index, item := range list {
Expand Down

0 comments on commit 13ab724

Please sign in to comment.