1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
1. type Student struct{ id int64 teacher []*Teacher `orm:"rel(m2m)"` father *Father `orm:"rel(fk)"` wife *Wife `orm:"rel(one)"` } type Teacher struct{ id int64 student []*Student `orm:"reverse(many)"` } type Father struct{ id int64 student []*Student `orm:"reverse(many)"` } type Wife struct{ id int64 studnet *Student `orm:"reverse(one)"` } 2. 一对多 rel(fk) reverse(many) 一对一 rel(one) reverse(one) 多对多 rel(m2m) reverse(many)
|
近期评论