MCPcopy Create free account
hub / github.com/go-pg/pg / BenchmarkQueryRowScan

Function BenchmarkQueryRowScan

bench_test.go:235–253  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

233}
234
235func BenchmarkQueryRowScan(b *testing.B) {
236 db := benchmarkDB()
237 defer db.Close()
238
239 b.ResetTimer()
240
241 b.RunParallel(func(pb *testing.PB) {
242 for pb.Next() {
243 var n int64
244 _, err := db.QueryOne(pg.Scan(&n), `SELECT ? AS num`, 1)
245 if err != nil {
246 b.Fatal(err)
247 }
248 if n != 1 {
249 b.Fatalf("got %d, wanted 1", n)
250 }
251 }
252 })
253}
254
255func BenchmarkQueryRowStmtScan(b *testing.B) {
256 db := benchmarkDB()

Callers

nothing calls this directly

Calls 4

benchmarkDBFunction · 0.85
CloseMethod · 0.65
QueryOneMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…