17 lines
411 B
Go
17 lines
411 B
Go
package models
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
type User struct {
|
|
gorm.Model
|
|
Username string `json:"username" gorm:"uniqueIndex;not null"`
|
|
Password string `json:"-" gorm:"not null"`
|
|
Email string `json:"email" gorm:"uniqueIndex;not null"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Roles []Role `json:"roles" gorm:"many2many:user_roles;"`
|
|
}
|