
gorm
gorm
tnan2522
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Gorm设置外键
在 设置外键的时候不是只将字段和要关联的外键的结构体对应上就可以了, 还需要写一个关联的字段id 如: type Blog struct { ID uint `gorm:"primary_key"` Title string `gorm:"not null;size:256"` Content string `gorm:"type:text;not null"` ShowContent string `gorm:"not null"` LookNum int `gorm:"defau原创 2020-07-06 21:48:03 · 10859 阅读 · 2 评论 -
golang gorm 查询
First type Student1 struct { ID int `gorm:"primary_key"` Name string `gorm:"type:varchar(100)"` // `这种是数据库的约束` Chinese int English int Math int } func selects(db *gorm.DB) { ...原创 2020-04-15 21:30:47 · 4606 阅读 · 0 评论