You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
440 B
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type User struct {
ID uuid.UUID `gorm:"primarykey;type:uuid"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
Email string `validate:"required,min=3,email"`
Password string `validate:"required,min=3"`
}
func (user *User) BeforeCreate(tx *gorm.DB) (err error) {
user.ID = uuid.New()
return
}