(b *testing.B)
| 102 | } |
| 103 | |
| 104 | func BenchmarkMinimalPreparedSelect(b *testing.B) { |
| 105 | conn := mustConnect(b, mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))) |
| 106 | defer closeConn(b, conn) |
| 107 | |
| 108 | _, err := conn.Prepare(context.Background(), "ps1", "select $1::int8") |
| 109 | if err != nil { |
| 110 | b.Fatal(err) |
| 111 | } |
| 112 | |
| 113 | var n int64 |
| 114 | |
| 115 | for i := 0; b.Loop(); i++ { |
| 116 | err = conn.QueryRow(context.Background(), "ps1", i).Scan(&n) |
| 117 | if err != nil { |
| 118 | b.Fatal(err) |
| 119 | } |
| 120 | |
| 121 | if n != int64(i) { |
| 122 | b.Fatalf("expected %d, got %d", i, n) |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | func BenchmarkMinimalPgConnPreparedSelect(b *testing.B) { |
| 128 | conn := mustConnect(b, mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))) |
nothing calls this directly
no test coverage detected