1
0
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:
Pelle Johnsen
2015-12-15 17:17:56 +01:00
parent 332fa44231
commit 906637ae8b
3 changed files with 89 additions and 1 deletions

View File

@ -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