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

production ! #1

Open
0x457 opened this issue May 18, 2020 · 10 comments
Open

production ! #1

0x457 opened this issue May 18, 2020 · 10 comments

Comments

@0x457
Copy link

0x457 commented May 18, 2020

Can it be used in production?

@jukylin
Copy link
Owner

jukylin commented May 19, 2020 via email

@0x457
Copy link
Author

0x457 commented May 19, 2020

 
CREATE TABLE IF NOT EXISTS  test(
  id int not NULL auto_increment,
  title VARCHAR(10) not NULL DEFAULT '',
  PRIMARY KEY (`id`)
)engine=innodb;

run :
esim db2entity -d saep-min -t test

panic:
{"level":"panic","ts":"2020-05-19 16:26:11","msg":"err 97:3: expected statement, found '.' : package dao\n\nimport (\n\n "context"\n "github.com/jinzhu/gorm"\n "errors"\n "github.com/jukylin/esim/mysql"\n "saep.cn/wstest/"\n)\n\ntype TestDao struct{\n\tmysql *mysql.Client\n}\n\nfunc NewTestDao() *TestDao {\n\tdao := &TestDao{\n\t\tmysql : mysql.NewClient(),\n\t}\n\n\treturn dao\n}\n\n\n//主库\nfunc (td *TestDao) GetDb(ctx context.Context) *gorm.DB {\n\treturn td.mysql.GetCtxDb(ctx, "saep-mini").Table("test")\n}\n\n//从库\nfunc (td *TestDao) GetSlaveDb(ctx context.Context) *gorm.{\n\treturn td.mysql.GetCtxDb(ctx, "saep-mini_slave").Table("test")\n}\n\n\n//返回 自增id,错误\nfunc (td *TestDao)

@jukylin
Copy link
Owner

jukylin commented May 19, 2020

fix

@0x457
Copy link
Author

0x457 commented May 19, 2020

esim db2entity -d saep-mini -t test

{"level":"error","ts":"2020-05-19 18:08:12","msg":"A panic occurred : runtime error: invalid memory address or nil pointer dereference","caller":"db2entity/db2entity.go:155","stacktrace":"github.com/jukylin/esim/log.(*logger).Errorf\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/log/logger.go:98\ngithub.com/jukylin/esim/tool/db2entity.(*Db2Entity).Run.func1\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/tool/db2entity/db2entity.go:155\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:969\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:212\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:695\ngithub.com/jukylin/esim/tool/db2entity.(*Db2Entity).Run\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/tool/db2entity/db2entity.go:171\ngithub.com/jukylin/esim/tool/cmd.glob..func1\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/tool/cmd/db2entity.go:66\ngithub.com/spf13/cobra.(*Command).execute\n\t/Users/bruce/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/Users/bruce/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950\ngithub.com/spf13/cobra.(*Command).Execute\n\t/Users/bruce/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887\ngithub.com/jukylin/esim/tool/cmd.Execute\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/tool/cmd/root.go:34\nmain.main\n\t/Users/bruce/go/pkg/mod/github.com/jukylin/esim@v0.0.8/tool/main.go:21\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"}

@jukylin
Copy link
Owner

jukylin commented May 19, 2020 via email

@jukylin

This comment has been minimized.

@0x457

This comment has been minimized.

@0x457
Copy link
Author

0x457 commented May 20, 2020

1589935923730
用esim db2entity -d saep-mini -t test生成的与原始new命令生成的不一样:结构/文件名==,另外还 有一些错误,给出了部分:

/usr/local/go/src/path/filepath/match.go:13:2: could not import unicode/utf8 (invalid package name: "")
/usr/local/go/src/go/token/token.go:13:2: could not import unicode/utf8 (invalid package name: "")
/usr/local/go/src/encoding/json/decode.go:19:2: could not import unicode/utf8 (invalid package name: "")
/usr/local/go/src/database/sql/convert.go:17:2: could not import unicode/utf8 (invalid package name: "")
/usr/local/go/src/go/scanner/scanner.go:18:2: could not import unicode/utf8 (invalid package name: "")
/Users/bruce/go/src/github.com/jinzhu/gorm/dialect_mysql.go:11:2: could not import unicode/utf8 (invalid package name: "")
/Users/bruce/go/src/saep.cn/wstest/internal/infra/dao/test.go:8:2: could not import github.com/jukylin/esim/mysql (cannot find package "github.com/jukylin/esim/mysql" in any of:
/usr/local/go/src/github.com/jukylin/esim/mysql (from $GOROOT)
/Users/bruce/go/src/github.com/jukylin/esim/mysql (from $GOPATH))
/Users/bruce/go/src/saep.cn/wstest/internal/infra/dao/test.go:35:8: undeclared name: entity
/Users/bruce/go/src/saep.cn/wstest/internal/infra/dao/test.go:58:44: undeclared name: entity
/Users/bruce/go/src/saep.cn/wstest/internal/infra/dao/test.go:72:46: undeclared name: entity
/Users/bruce/go/src/saep.cn/wstest/internal/infra/repo/test.go:6:2: could not import github.com/jukylin/esim/log (cannot find package "github.com/jukylin/esim/log" in any of:
/usr/local/go/src/github.com/jukylin/esim/log (from $GOROOT)
/Users/bruce/go/src/github.com/jukylin/esim/log (from $GOPATH))
/Users/bruce/go/src/saep.cn/wstest/internal/infra/infra.go:6:2: could not import github.com/google/wire (cannot find package "github.com/google/wire" in any of:

@jukylin
Copy link
Owner

jukylin commented May 20, 2020

你有很多依赖没有安装,esim项目你放在了GOPATH里面了?

@0x457
Copy link
Author

0x457 commented May 20, 2020

肯定的

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