(b *testing.B)
| 280 | } |
| 281 | |
| 282 | func BenchmarkQueryContext(b *testing.B) { |
| 283 | db := initDB(b, false, |
| 284 | "DROP TABLE IF EXISTS foo", |
| 285 | "CREATE TABLE foo (id INT PRIMARY KEY, val CHAR(50))", |
| 286 | `INSERT INTO foo VALUES (1, "one")`, |
| 287 | `INSERT INTO foo VALUES (2, "two")`, |
| 288 | ) |
| 289 | defer db.Close() |
| 290 | for _, p := range []int{1, 2, 3, 4} { |
| 291 | b.Run(fmt.Sprintf("%d", p), func(b *testing.B) { |
| 292 | benchmarkQueryContext(b, db, p) |
| 293 | }) |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | func benchmarkExecContext(b *testing.B, db *sql.DB, p int) { |
| 298 | ctx, cancel := context.WithCancel(context.Background()) |
nothing calls this directly
no test coverage detected