Open aboychen opened 3 weeks ago
目前我没办法做了六个数据库视图解决的,不清楚有没有简单一点的方法
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question
template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
表1: type Speaker struct { Id int64
gorm:"primaryKey;autoIncrement;column:id"
UserName stringgorm:"size:50;column:user_name;comment:姓名"
Avatar stringgorm:"column:avatar;comment:头像"
Gender stringgorm:"column:gender;comment:性别"
StyleName stringgorm:"column:style_name;comment:调用名称"
Domain []Dictgorm:"many2many:speaker_dict"
Emotion []Dictgorm:"many2many:speaker_dict"
Language []Dictgorm:"many2many:speaker_dict"
} 表2: type Dict struct { Id int64gorm:"primaryKey;autoIncrement;column:id"
Channel stringgorm:"size:64;column:channel;comment:频道"
Name stringgorm:"size:64;column:name;comment:英文名称"
Title stringgorm:"size:64;column:title;comment:中文名称"
}中间表: type SpeakerDict struct { SpeakerId int64
gorm:"column:speaker_id;comment:发音人编号"
DictId int64gorm:"column:dict_id;comment:字典编号"
} 因为中间表的字典表是公用的 请问这样的多对多应该怎么写呢? 设置外键会提示中间domain_id不存在,但是我根本没这个字段,好像指定外键也不行