GORM 关联查询

定义了一个 User 和 Company, User 中可以包含多个 Company, 如下: type User struct { ID int `gorm:"TYPE:int(11);NOT NULL;PRIMARY_KEY;INDEX"` Name string `gorm:"TYPE: VARCHAR(255); DEFAULT:'';INDEX"` Companies []Company `gorm:"FOREIGNKEY:UserId;ASSOCIATION_FOREIGNKEY:I...阅读全文

2018-12-05 11:34:43 jouyouyun
阅读:4981 评论:1