/
test_conf.check.go
65 lines (53 loc) · 1.32 KB
/
test_conf.check.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package devcheck
import (
"fmt"
"log"
"github.com/pkg/errors"
"github.com/tableauio/checker/test/protoconf/tableau"
)
type ActivityConf struct {
tableau.ActivityConf
}
func (x *ActivityConf) Check(hub *tableau.Hub) error {
// TODO: implement here.
return nil
}
func (x *ActivityConf) CheckCompatibility(hub, newHub *tableau.Hub) error {
// TODO: implement here.
return nil
}
type ItemConf struct {
tableau.ItemConf
}
func (x *ItemConf) Check(hub *tableau.Hub) error {
fmt.Printf("ItemConf: check\n %v\n", x.ItemConf.Data())
conf1 := hub.GetItemConf()
if conf1 == nil {
return errors.Errorf("ItemConf is nil")
}
conf := hub.GetActivityConf()
if conf == nil {
return errors.Errorf("ActivityConf is nil")
}
chapter, err := conf.Get3(100001, 1, 2)
if err != nil {
return errors.WithMessagef(err, "failed to get chapter: Get3(100001, 1, 2)")
}
fmt.Printf("ActivityConf: %v\n", chapter)
return nil
}
func (x *ItemConf) CheckCompatibility(hub, newHub *tableau.Hub) error {
// TODO: implement here.
log.Printf("old: %v\n", x.Data())
log.Printf("new: %v", newHub.GetItemConf().Data())
return nil
}
func init() {
// NOTE: This func is auto-generated. DO NOT EDIT.
register("ActivityConf", func() tableau.Messager {
return &ActivityConf{}
})
register("ItemConf", func() tableau.Messager {
return &ItemConf{}
})
}