-
-
Notifications
You must be signed in to change notification settings - Fork 98
/
GoMybatis_test.go
48 lines (45 loc) · 960 Bytes
/
GoMybatis_test.go
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
42
43
44
45
46
47
48
package GoMybatis
import (
"github.com/zhuxiujia/GoMybatis/example"
"reflect"
"testing"
"time"
)
func TestScanStructArgFields(ff *testing.T) {
var act = example.Activity{
Id: "123",
Uuid: "uu",
Name: "test",
PcLink: "pc",
H5Link: "h5",
Remark: "remark",
Version: 0,
CreateTime: time.Now(),
DeleteFlag: 1,
}
scanStructArgFields(reflect.ValueOf(act), nil)
var t = reflect.TypeOf(act)
for i := 0; i < t.NumField(); i++ {
var typeValue = t.Field(i)
var jsonKey = typeValue.Tag.Get(`json`)
println(jsonKey)
}
}
func BenchmarkScanStructArgFields(b *testing.B) {
b.StopTimer()
var act = example.Activity{
Id: "123",
Uuid: "uu",
Name: "test",
PcLink: "pc",
H5Link: "h5",
Remark: "remark",
Version: 0,
CreateTime: time.Now(),
DeleteFlag: 1,
}
b.StartTimer()
for i := 0; i < b.N; i++ {
scanStructArgFields(reflect.ValueOf(act), nil)
}
}