(b *testing.B)
| 135 | } |
| 136 | |
| 137 | func (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 | |
| 165 | func (ent *Ent) ReadSlice(b *testing.B) { |
| 166 | m := NewModelAlt() |
nothing calls this directly
no test coverage detected