(b *testing.B)
| 125 | } |
| 126 | |
| 127 | func BenchmarkMinimalPgConnPreparedSelect(b *testing.B) { |
| 128 | conn := mustConnect(b, mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))) |
| 129 | defer closeConn(b, conn) |
| 130 | |
| 131 | pgConn := conn.PgConn() |
| 132 | |
| 133 | _, err := pgConn.Prepare(context.Background(), "ps1", "select $1::int8", nil) |
| 134 | if err != nil { |
| 135 | b.Fatal(err) |
| 136 | } |
| 137 | |
| 138 | encodedBytes := make([]byte, 8) |
| 139 | |
| 140 | for b.Loop() { |
| 141 | |
| 142 | rr := pgConn.ExecPrepared(context.Background(), "ps1", [][]byte{encodedBytes}, []int16{1}, []int16{1}) |
| 143 | if err != nil { |
| 144 | b.Fatal(err) |
| 145 | } |
| 146 | |
| 147 | for rr.NextRow() { |
| 148 | for i := range rr.Values() { |
| 149 | if !bytes.Equal(rr.Values()[0], encodedBytes) { |
| 150 | b.Fatalf("unexpected values: %s %s", rr.Values()[i], encodedBytes) |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | _, err = rr.Close() |
| 155 | if err != nil { |
| 156 | b.Fatal(err) |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func BenchmarkMinimalPgConnPreparedStatementDescriptionSelect(b *testing.B) { |
| 162 | conn := mustConnect(b, mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))) |
nothing calls this directly
no test coverage detected