package domain //Role reflects a role record of the roles table. type Role struct { ID uint `gorm:"column:user_role_id;primary_key"` CompanyRole uint `gorm:"column:company_id"` Name string `gorm:"column:name"` Rights []Right `gorm:"foreignkey:ID"` } // TableName returns the name of the Roles table func (Role) TableName() string { return "user_role" } //Right reflects a right of the rights table. type Right struct { ID uint `gorm:"column:user_role_id;primary_key"` Code string `gorm:"column:right_code;primary_key"` } // TableName returns the name of the Rights table func (Right) TableName() string { return "user_role_right" }