mirror of
https://github.com/astaxie/beego.git
synced 2025-07-03 18:00:17 +00:00
Fix issue with reverse(many) for models with custom pk
- Also add test covering the issue
This commit is contained in:
@ -332,6 +332,24 @@ func NewComment() *Comment {
|
||||
return obj
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
GID string `orm:"pk;column(gid);size(32);unique"`
|
||||
Name string
|
||||
Permissions []*Permission `orm:"reverse(many)" json:"-"`
|
||||
}
|
||||
|
||||
type Permission struct {
|
||||
ID int `orm:"column(id)"`
|
||||
Name string
|
||||
Groups []*Group `orm:"rel(m2m);rel_through(github.com/astaxie/beego/orm.GroupPermissions)"`
|
||||
}
|
||||
|
||||
type GroupPermissions struct {
|
||||
ID int `orm:"column(id)"`
|
||||
Group *Group `orm:"rel(fk)"`
|
||||
Permission *Permission `orm:"rel(fk)"`
|
||||
}
|
||||
|
||||
var DBARGS = struct {
|
||||
Driver string
|
||||
Source string
|
||||
|
Reference in New Issue
Block a user