package models import ( "errors" ) var ErrEmptyPassword = errors.New("empty password") type User struct { Model Username string `gorm:"unique" json:"username"` Email string `gorm:"unique" json:"email"` Password string `json:"-"` Experience int Games []*GameCursor Role UserRole } func (u *User) HasRole(role UserRole) bool { return u.Role >= role } type UserRole int const ( RoleUser UserRole = iota RoleCreator RoleAdmin )