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

Method InsertMulti

bench/upper.go:65–85  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

63}
64
65func (upper *Upper) InsertMulti(b *testing.B) {
66 m := NewModel4()
67
68 b.ReportAllocs()
69 b.ResetTimer()
70
71 for i := 0; i < b.N; i++ {
72 batch := upper.conn.SQL().InsertInto("models").Columns("name", "title", "fax", "web", "age", "right", "counter").Batch(100)
73
74 go func() {
75 for i := 0; i < 100; i++ {
76 batch.Values(m.Name, m.Title, m.Fax, m.Web, m.Age, m.Right, m.Counter)
77 }
78 batch.Done()
79 }()
80
81 if err := batch.Wait(); err != nil {
82 helper.SetError(b, upper.Name(), "InsertMulti", err.Error())
83 }
84 }
85}
86
87func (upper *Upper) Update(b *testing.B) {
88 m := NewModel4()

Callers

nothing calls this directly

Calls 6

NameMethod · 0.95
SetErrorFunction · 0.92
NewModel4Function · 0.85
ColumnsMethod · 0.80
ValuesMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected