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

Method Read

bench/ent.go:137–163  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

135}
136
137func (ent *Ent) Read(b *testing.B) {
138 m := NewModelAlt()
139
140 created, err := ent.conn.Model.Create().
141 SetName(m.Name).
142 SetTitle(m.Title).
143 SetFax(m.Fax).
144 SetWeb(m.Web).
145 SetAge(m.Age).
146 SetRight(m.Right).
147 SetCounter(m.Counter).
148 Save(ctx)
149 if err != nil {
150 helper.SetError(b, ent.Name(), "Read", err.Error())
151 }
152 m.Id = created.ID
153
154 b.ReportAllocs()
155 b.ResetTimer()
156
157 for i := 0; i < b.N; i++ {
158 _, err := ent.conn.Model.Query().Where(model.IDEQ(m.Id)).First(ctx)
159 if err != nil {
160 helper.SetError(b, ent.Name(), "Read", err.Error())
161 }
162 }
163}
164
165func (ent *Ent) ReadSlice(b *testing.B) {
166 m := NewModelAlt()

Callers

nothing calls this directly

Calls 15

NameMethod · 0.95
SetErrorFunction · 0.92
IDEQFunction · 0.92
NewModelAltFunction · 0.85
FirstMethod · 0.80
ErrorMethod · 0.65
SaveMethod · 0.45
SetCounterMethod · 0.45
SetRightMethod · 0.45
SetAgeMethod · 0.45
SetWebMethod · 0.45
SetFaxMethod · 0.45

Tested by

no test coverage detected