package models // UsersGroup is one row of users_groups, the pivot behind User.Groups: the // user is a member of the group. The table has exactly these two columns and // a composite primary key over them. The admin user form's groups field is // its only writer, apart from the cleanup of a permanently deleted user or // group. type UsersGroup struct { UserID uint `gorm:"column:user_id;primaryKey"` UserGroupID uint `gorm:"column:user_group_id;primaryKey"` } func (UsersGroup) TableName() string { return "users_groups" } func init() { Register(UsersGroup{}) }