Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生成go文件的bug? #98

Open
duxiaogang opened this issue Mar 16, 2022 · 4 comments
Open

生成go文件的bug? #98

duxiaogang opened this issue Mar 16, 2022 · 4 comments

Comments

@duxiaogang
Copy link

在自动生成的代码 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]}

@davyxu
Copy link
Owner

davyxu commented Mar 17, 2022

是bug, 稍后修正提交

@davyxu
Copy link
Owner

davyxu commented Mar 17, 2022

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

@duxiaogang
Copy link
Author

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

可以了

@duxiaogang
Copy link
Author

是bug, 稍后修正提交

赞美~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants