- 在项目中引入 GORM 相关依赖 - 添加 GORM代码生成工具 gen.go - 更新 MySQL 数据库配置 - 新增 .env 文件到 .gitignore
10 lines
201 B
Go
10 lines
201 B
Go
package model
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
type User struct {
|
|
gorm.Model
|
|
Email string `gorm:"uniqueIndex;type:varchar(255) not null"`
|
|
PasswordHashed string `gorm:"type:varchar(255) not null"`
|
|
}
|