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

Method Insert

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

Source from the content-addressed store, hash-verified

47}
48
49func (ent *Ent) Insert(b *testing.B) {
50 m := NewModelAlt()
51
52 b.ReportAllocs()
53 b.ResetTimer()
54
55 for i := 0; i < b.N; i++ {
56 _, err := ent.conn.Model.Create().
57 SetName(m.Name).
58 SetTitle(m.Title).
59 SetFax(m.Fax).
60 SetWeb(m.Web).
61 SetAge(m.Age).
62 SetRight(m.Right).
63 SetCounter(m.Counter).
64 Save(ctx)
65 if err != nil {
66 helper.SetError(b, ent.Name(), "Insert", err.Error())
67 }
68 }
69}
70
71func (ent *Ent) InsertMulti(b *testing.B) {
72 ms := make([]Model, 0, 100)

Callers

nothing calls this directly

Calls 13

NameMethod · 0.95
SetErrorFunction · 0.92
NewModelAltFunction · 0.85
ErrorMethod · 0.65
SaveMethod · 0.45
SetCounterMethod · 0.45
SetRightMethod · 0.45
SetAgeMethod · 0.45
SetWebMethod · 0.45
SetFaxMethod · 0.45
SetTitleMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected