mirror of
https://github.com/golang/go
synced 2024-11-21 16:24:40 -07:00
Test default behavior for other column types
Only int64 is overridden.
This commit is contained in:
parent
0a38201765
commit
13ab724acf
@ -4282,16 +4282,22 @@ func TestRowsColumnScanner(t *testing.T) {
|
|||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
str string
|
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 {
|
if err != nil {
|
||||||
t.Fatal("select", err)
|
t.Fatal("select", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
list := []struct{ got, want any }{
|
list := []struct{ got, want any }{
|
||||||
{str, "foo"},
|
{str, "foo"},
|
||||||
{n, int64(42)},
|
{i64, int64(42)},
|
||||||
|
{i, int(1)},
|
||||||
|
{f64, float64(1)},
|
||||||
|
{ui, uint(1)},
|
||||||
}
|
}
|
||||||
|
|
||||||
for index, item := range list {
|
for index, item := range list {
|
||||||
|
Loading…
Reference in New Issue
Block a user