go-backend-starter-project/models/userModel.go

21 lines
336 B
Go
Raw Normal View History

2024-02-15 00:36:17 +01:00
package models
import (
"github.com/google/uuid"
"gorm.io/gorm"
"time"
)
type User struct {
ID uuid.UUID `gorm:"type:char(36);primary_key;"`
CreatedAt time.Time
UpdatedAt time.Time
Email string
Password string `json:"-"`
}
func (user *User) BeforeCreate(tx *gorm.DB) (err error) {
user.ID = uuid.New()
return
}