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

Method ReadSlice

bench/upper.go:125–145  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

123}
124
125func (upper *Upper) ReadSlice(b *testing.B) {
126 m := NewModel4()
127 for i := 0; i < 100; i++ {
128 m.ID = 0
129 err := upper.conn.Collection("models").InsertReturning(m)
130 if err != nil {
131 helper.SetError(b, upper.Name(), "ReadSlice", err.Error())
132 }
133 }
134
135 b.ReportAllocs()
136 b.ResetTimer()
137
138 for i := 0; i < b.N; i++ {
139 var ms []*Model4
140 err := upper.conn.SQL().SelectFrom("models").Where("id > ?", m.ID).Limit(100).All(&ms)
141 if err != nil {
142 helper.SetError(b, upper.Name(), "ReadSlice", err.Error())
143 }
144 }
145}

Callers

nothing calls this directly

Calls 7

NameMethod · 0.95
SetErrorFunction · 0.92
NewModel4Function · 0.85
LimitMethod · 0.80
ErrorMethod · 0.65
AllMethod · 0.45
WhereMethod · 0.45

Tested by

no test coverage detected