-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathderive_test.go
More file actions
41 lines (35 loc) · 786 Bytes
/
derive_test.go
File metadata and controls
41 lines (35 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package dali
import (
"reflect"
"testing"
)
type BenchStruct struct {
ID int64 `db:"id,selectonly"`
Name string `db:"name"`
Email string `db:"email"`
GroupID int64 `db:"group_id"`
Ignore int `db:"-"`
}
type BenchEmbedded struct {
ID int64 `db:"id"`
Name
Email string `db:"email"`
}
func BenchmarkColNamesAndFieldIndexes(b *testing.B) {
typ := reflect.TypeFor[BenchStruct]()
for b.Loop() {
colNamesAndFieldIndexes(typ, true)
}
}
func BenchmarkColNamesAndFieldIndexes_select(b *testing.B) {
typ := reflect.TypeFor[BenchStruct]()
for b.Loop() {
colNamesAndFieldIndexes(typ, false)
}
}
func BenchmarkColNamesAndFieldIndexes_embedded(b *testing.B) {
typ := reflect.TypeFor[BenchEmbedded]()
for b.Loop() {
colNamesAndFieldIndexes(typ, true)
}
}