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

Method Update

bench/dbr.go:63–88  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

61}
62
63func (dbr *Dbr) Update(b *testing.B) {
64 m := NewModel2()
65
66 _, err := dbr.conn.InsertInto("models").Columns(columns...).Record(m).Exec()
67 if err != nil {
68 helper.SetError(b, dbr.Name(), "Update", err.Error())
69 }
70
71 b.ReportAllocs()
72 b.ResetTimer()
73
74 for i := 0; i < b.N; i++ {
75 _, err := dbr.conn.Update("models").SetMap(map[string]any{
76 "name": m.Name,
77 "title": m.Title,
78 "fax": m.Fax,
79 "web": m.Web,
80 "age": m.Age,
81 "right": m.Right,
82 "counter": m.Counter,
83 }).Exec()
84 if err != nil {
85 helper.SetError(b, dbr.Name(), "Update", err.Error())
86 }
87 }
88}
89
90func (dbr *Dbr) Read(b *testing.B) {
91 m := NewModel2()

Callers

nothing calls this directly

Calls 7

NameMethod · 0.95
SetErrorFunction · 0.92
NewModel2Function · 0.85
ColumnsMethod · 0.80
ErrorMethod · 0.65
UpdateMethod · 0.65
ExecMethod · 0.45

Tested by

no test coverage detected