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

Method Read

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

Source from the content-addressed store, hash-verified

95}
96
97func (sqlx *Sqlx) Read(b *testing.B) {
98 m := NewModel()
99 _, err := sqlx.conn.Exec(sqlxInsertSQL, m.Name, m.Title, m.Fax, m.Web, m.Age, m.Right, m.Counter)
100 if err != nil {
101 helper.SetError(b, sqlx.Name(), "Read", err.Error())
102 }
103
104 b.ReportAllocs()
105 b.ResetTimer()
106
107 for i := 0; i < b.N; i++ {
108 var m []Model
109 err := sqlx.conn.Select(&m, sqlxSelectSQL, 1)
110 if err != nil {
111 helper.SetError(b, sqlx.Name(), "Read", err.Error())
112 }
113 }
114}
115
116func (sqlx *Sqlx) ReadSlice(b *testing.B) {
117 m := NewModel()

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