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

Method ReadSlice

bench/pg.go:116–136  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

114}
115
116func (pg *Pg) ReadSlice(b *testing.B) {
117 m := NewModel()
118 for i := 0; i < 100; i++ {
119 m.Id = 0
120 _, err := pg.conn.Model(m).Insert()
121 if err != nil {
122 helper.SetError(b, pg.Name(), "ReadSlice", err.Error())
123 }
124 }
125
126 b.ReportAllocs()
127 b.ResetTimer()
128
129 for i := 0; i < b.N; i++ {
130 var models []*Model
131 err := pg.conn.Model(&models).Where("id > ?", 0).Limit(100).Select()
132 if err != nil {
133 helper.SetError(b, pg.Name(), "ReadSlice", err.Error())
134 }
135 }
136}

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected