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

Method Read

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

Source from the content-addressed store, hash-verified

104}
105
106func (upper *Upper) Read(b *testing.B) {
107 m := NewModel4()
108
109 err := upper.conn.Collection("models").InsertReturning(m)
110 if err != nil {
111 helper.SetError(b, upper.Name(), "Read", err.Error())
112 }
113
114 b.ReportAllocs()
115 b.ResetTimer()
116
117 for i := 0; i < b.N; i++ {
118 err := upper.conn.SQL().SelectFrom("models").Where("id = ?", m.ID).One(m)
119 if err != nil {
120 helper.SetError(b, upper.Name(), "Read", err.Error())
121 }
122 }
123}
124
125func (upper *Upper) ReadSlice(b *testing.B) {
126 m := NewModel4()

Callers

nothing calls this directly

Calls 6

NameMethod · 0.95
SetErrorFunction · 0.92
NewModel4Function · 0.85
OneMethod · 0.80
ErrorMethod · 0.65
WhereMethod · 0.45

Tested by

no test coverage detected