(b *testing.B)
| 972 | } |
| 973 | |
| 974 | func BenchmarkSelectRowsScanSimple(b *testing.B) { |
| 975 | conn := mustConnectString(b, os.Getenv("PGX_TEST_DATABASE")) |
| 976 | defer closeConn(b, conn) |
| 977 | |
| 978 | rowCounts := getSelectRowsCounts(b) |
| 979 | |
| 980 | for _, rowCount := range rowCounts { |
| 981 | b.Run(fmt.Sprintf("%d rows", rowCount), func(b *testing.B) { |
| 982 | br := &BenchRowSimple{} |
| 983 | for b.Loop() { |
| 984 | rows, err := conn.Query(context.Background(), "select n, 'Adam', 'Smith ' || n, 'male', '1952-06-16'::date, 258, 72, '{foo,bar,baz}'::text[], '2001-01-28 01:02:03-05'::timestamptz from generate_series(100001, 100000 + $1) n", rowCount) |
| 985 | if err != nil { |
| 986 | b.Fatal(err) |
| 987 | } |
| 988 | |
| 989 | for rows.Next() { |
| 990 | rows.Scan(&br.ID, &br.FirstName, &br.LastName, &br.Sex, &br.BirthDate, &br.Weight, &br.Height, &br.Tags, &br.UpdateTime) |
| 991 | } |
| 992 | |
| 993 | if rows.Err() != nil { |
| 994 | b.Fatal(rows.Err()) |
| 995 | } |
| 996 | } |
| 997 | }) |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | type BenchRowStringBytes struct { |
| 1002 | ID int32 |
nothing calls this directly
no test coverage detected