(b *testing.B)
| 69 | } |
| 70 | |
| 71 | func (ent *Ent) InsertMulti(b *testing.B) { |
| 72 | ms := make([]Model, 0, 100) |
| 73 | for i := 0; i < 100; i++ { |
| 74 | ms = append(ms, NewModelAlt()) |
| 75 | } |
| 76 | |
| 77 | b.ReportAllocs() |
| 78 | b.ResetTimer() |
| 79 | |
| 80 | bulk := make([]*entdb.ModelCreate, len(ms)) |
| 81 | for i, m := range ms { |
| 82 | bulk[i] = ent.conn.Model.Create(). |
| 83 | SetName(m.Name). |
| 84 | SetTitle(m.Title). |
| 85 | SetFax(m.Fax). |
| 86 | SetWeb(m.Web). |
| 87 | SetAge(m.Age). |
| 88 | SetRight(m.Right). |
| 89 | SetCounter(m.Counter) |
| 90 | } |
| 91 | |
| 92 | for i := 0; i < b.N; i++ { |
| 93 | _, err := ent.conn.Model.CreateBulk(bulk...).Save(ctx) |
| 94 | if err != nil { |
| 95 | helper.SetError(b, ent.Name(), "InsertMulti", err.Error()) |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func (ent *Ent) Update(b *testing.B) { |
| 101 | m := NewModelAlt() |
nothing calls this directly
no test coverage detected