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

MySQL表结构为TINYINT的field,自动生成的是int32,而不是int8 #1189

Closed
zaaztt opened this issue Aug 16, 2024 · 3 comments
Closed

Comments

@zaaztt
Copy link

zaaztt commented Aug 16, 2024

GORM Playground Link

go-gorm/playground#1

Description

table原始表中是tinyint的项目,应该对应go中的int8,但是经过gen生成的全都是int32

@qqxhb
Copy link
Member

qqxhb commented Aug 16, 2024

@zaaztt 这个是设计如此哈;业务场景使用更多的就是 int32和int64,所以默认都是生成这两个了

不满足你们诉求的可以通过FIeldType或者是datamapping 配置哈

@zaaztt
Copy link
Author

zaaztt commented Aug 17, 2024

@zaaztt 这个是设计如此哈;业务场景使用更多的就是 int32和int64,所以默认都是生成这两个了

不满足你们诉求的可以通过FIeldType或者是datamapping 配置哈

@qqxhb 推荐我直接修改gen生成的struct吗?比如手动把int32改成int8

@qqxhb
Copy link
Member

qqxhb commented Aug 19, 2024

@zaaztt 这个是设计如此哈;业务场景使用更多的就是 int32和int64,所以默认都是生成这两个了
不满足你们诉求的可以通过FIeldType或者是datamapping 配置哈

@qqxhb 推荐我直接修改gen生成的struct吗?比如手动把int32改成int8

不推荐哈,因为直接改struct下次生成又被覆盖了

@qqxhb qqxhb closed this as completed Sep 6, 2024
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