roles.go 400 B

123456789101112131415161718192021222324
  1. package models
  2. import (
  3. "errors"
  4. "github.com/jinzhu/gorm"
  5. )
  6. // Role 角色表
  7. type Role struct {
  8. gorm.Model
  9. RecordId string `gorm:"column:record_id;size:32;index"`
  10. RoleName string `gorm:"size:50;not null"`
  11. RoleCode int32
  12. MenuList string `gorm:"size:100000;"`
  13. }
  14. // Validate ``
  15. func (a *Role) Validate() error {
  16. if a.RoleName == "" {
  17. return errors.New("角色名为空")
  18. }
  19. return nil
  20. }