Files
nixcn-cms/data/user.go
Asai Neko f130401ff8 Add dev services
- Development dotenvs
- Caddy service
- Redis service
- Postgres service
- Fix env parser error

Signed-off-by: Asai Neko <sugar@sne.moe>
2025-12-20 01:27:11 +08:00

23 lines
763 B
Go

package data
import "github.com/google/uuid"
type User struct {
Id uint `json:"id" gorm:"primarykey;autoincrement"`
UUID uuid.UUID `json:"uuid" gorm:"type:uuid;uniqueindex;not null"`
UserId string `json:"user_id" gorm:"size:8;uniqueindex;not null"`
Email string `json:"email" gorm:"uniqueindex;not null"`
Nickname string `json:"nickname" gorm:"not null"`
Type string `json:"type" gorm:"not null"`
Subtitle string `json:"subtitle" gorm:"not null"`
Avatar string `json:"avatar" gorm:"not null"`
Checkin bool `json:"checkin" gorm:"not null"`
}
func (self *User) GetByEmail(email string) error {
if err := Database.Where("email = ?", email).First(&self).Error; err != nil {
return err
}
return nil
}