user.go 442 B

12345678910111213141516171819202122
  1. package model
  2. import (
  3. "gorm.io/gorm"
  4. "time"
  5. )
  6. type User struct {
  7. Id uint `gorm:"primarykey"`
  8. UserId string `gorm:"unique;not null"`
  9. Username string `gorm:"unique;not null"`
  10. Nickname string `gorm:"not null"`
  11. Password string `gorm:"not null"`
  12. Email string `gorm:"not null"`
  13. CreatedAt time.Time
  14. UpdatedAt time.Time
  15. DeletedAt gorm.DeletedAt `gorm:"index"`
  16. }
  17. func (u *User) TableName() string {
  18. return "users"
  19. }