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

Function BenchmarkQueryRow

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

Source from the content-addressed store, hash-verified

191}
192
193func BenchmarkQueryRow(b *testing.B) {
194 db := benchmarkDB()
195 defer db.Close()
196
197 b.ResetTimer()
198
199 for i := 0; i < b.N; i++ {
200 var dst numLoader
201 _, err := db.QueryOne(&dst, `SELECT ?::bigint AS num`, 1)
202 if err != nil {
203 b.Fatal(err)
204 }
205 if dst.Num != 1 {
206 b.Fatalf("got %d, wanted 1", dst.Num)
207 }
208 }
209}
210
211func BenchmarkQueryRowStmt(b *testing.B) {
212 db := benchmarkDB()

Callers

nothing calls this directly

Calls 3

benchmarkDBFunction · 0.85
CloseMethod · 0.65
QueryOneMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…