MCPcopy Create free account
hub / github.com/efectn/go-orm-benchmarks / ReadSlice

Method ReadSlice

bench/godb.go:107–126  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

105}
106
107func (godb *Godb) ReadSlice(b *testing.B) {
108 m := NewModel2()
109 for i := 0; i < 100; i++ {
110 err := godb.conn.Insert(m).Do()
111 if err != nil {
112 helper.SetError(b, godb.Name(), "ReadSlice", err.Error())
113 }
114 }
115
116 b.ReportAllocs()
117 b.ResetTimer()
118
119 for i := 0; i < b.N; i++ {
120 var ms []*Model2
121 err := godb.conn.Select(&ms).Where("id > 0").Limit(100).Do()
122 if err != nil {
123 helper.SetError(b, godb.Name(), "ReadSlice", err.Error())
124 }
125 }
126}

Callers

nothing calls this directly

Calls 8

NameMethod · 0.95
SetErrorFunction · 0.92
NewModel2Function · 0.85
LimitMethod · 0.80
InsertMethod · 0.65
ErrorMethod · 0.65
WhereMethod · 0.45
SelectMethod · 0.45

Tested by

no test coverage detected