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

gorm tag 主键问题 #17

Closed
zundaren opened this issue Feb 9, 2023 · 0 comments
Closed

gorm tag 主键问题 #17

zundaren opened this issue Feb 9, 2023 · 0 comments

Comments

@zundaren
Copy link

zundaren commented Feb 9, 2023

tagSetting := schema.ParseTagSetting(field.Tag.Get("gorm"), ";")
isPrimaryKey := utils.CheckTruth(tagSetting["PRIMARYKEY"], tagSetting["PRIMARY_KEY"])

sqlite,我是用 type 标签去生成数据库表结构,工具查看数据库结构没有问题,上面的判断主键是否需要做个调整
Id int json:"id" gorm:"type:integer not null primary key autoincrement;"

@zundaren zundaren closed this as completed Feb 9, 2023
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

1 participant