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

Method ReadSlice

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

Source from the content-addressed store, hash-verified

114}
115
116func (sqlx *Sqlx) ReadSlice(b *testing.B) {
117 m := NewModel()
118 for i := 0; i < 100; i++ {
119 _, err := sqlx.conn.Exec(sqlxInsertSQL, m.Name, m.Title, m.Fax, m.Web, m.Age, m.Right, m.Counter)
120 if err != nil {
121 helper.SetError(b, sqlx.Name(), "ReadSlice", err.Error())
122 }
123 }
124
125 b.ReportAllocs()
126 b.ResetTimer()
127
128 for i := 0; i < b.N; i++ {
129 ms := make([]Model, 100)
130 err := sqlx.conn.Select(&ms, sqlxSelectMultiSQL)
131 if err != nil {
132 helper.SetError(b, sqlx.Name(), "ReadSlice", err.Error())
133 }
134 }
135}

Callers

nothing calls this directly

Calls 6

NameMethod · 0.95
SetErrorFunction · 0.92
NewModelFunction · 0.85
ErrorMethod · 0.65
ExecMethod · 0.45
SelectMethod · 0.45

Tested by

no test coverage detected