davyxu / tabtoy

高性能表格数据导出器

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

生成go文件的bug?

duxiaogang opened this issue · comments

在自动生成的代码 tabtoy/v3/example/golang/table_gen.go 中,连续两次给 self.indexHandler["ExampleData"] 赋值,后面的值会冲掉前面的值吧?这导致 self.ExampleDataByID 一直为空

`
// 初始化表实例
func NewTable() *Table {

    self := &Table{
            indexHandler: make(map[string]func()),
            resetHandler: make(map[string]func()),
    }

    self.indexHandler["ExampleData"] = func() {
            for _, v := range self.ExampleData {
                    self.ExampleDataByID[v.ID] = v
            }
    }

    self.indexHandler["ExampleData"] = func() {
            for _, v := range self.ExampleData {
                    self.ExampleDataByID2[v.ID2] = v
            }
    }
    ...

`

实际运行go实例效果如下:
$ go run main.go table_gen.go
tab pre load clear
tab post load done
<nil>
KV: 8.8.8.8

load specified table: ExampleData
load specified table: ExampleKV
0 &{8.8.8.8 1024 [10 20]}

是bug, 稍后修正提交

7ec14e7
已提交, 可以自己取下代码编译生成一个新的tabtoy

7ec14e7 已提交, 可以自己取下代码编译生成一个新的tabtoy

可以了

是bug, 稍后修正提交

赞美~