user.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package user
  2. import (
  3. "go-common/library/time"
  4. )
  5. // TableName case tablename
  6. func (*User) TableName() string {
  7. return "user"
  8. }
  9. // User user model
  10. type User struct {
  11. ID int64 `gorm:"column:id" json:"id" params:"id;Min(1)"`
  12. UserName string `gorm:"column:username" json:"username" params:"username"`
  13. NickName string `gorm:"column:nickname" json:"nickname" params:"nickname"`
  14. Email string `gorm:"column:email" json:"email" params:"email"`
  15. Phone string `gorm:"column:phone" json:"phone" params:"phone"`
  16. Status int8 `gorm:"column:status" json:"status" params:"status"`
  17. AvatarURL string `gorm:"-" json:"avatar_url"`
  18. Ctime time.Time `gorm:"column:ctime" json:"ctime"`
  19. Mtime time.Time `gorm:"column:mtime" json:"-"`
  20. }
  21. // Pager user pager
  22. type Pager struct {
  23. Total int64 `json:"total"`
  24. Pn int `params:"pn" default:"1"`
  25. Ps int `params:"ps" default:"20"`
  26. Items []*User `json:"items"`
  27. }
  28. // Result contains user and modules and rules.
  29. type Result struct {
  30. Super bool `json:"superman"`
  31. Env string `json:"env"`
  32. User *User `json:"user"`
  33. Rules []string `json:"rules"`
  34. }