src.dualinventive.com/go/users-service/internal/domain/role.go

26 lines
686 B
Go

package domain
//Role reflects a role record of the roles table.
type Role struct {
ID uint `gorm:"column:user_role_id;primary_key"`
CompanyID uint `gorm:"column:company_id"`
Name string `gorm:"column:name"`
Rights []Right `gorm:"foreignkey:RoleID"`
}
// 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 {
RoleID uint `gorm:"column:user_role_id;primary_key"`
Code string `gorm:"column:right_code;primary_key"`
}
// TableName returns the name of the User Role Rights table
func (Right) TableName() string {
return "user_role_right"
}