feat(auth+db): 实现注册登录核心逻辑,以及自动建表,用户信息落库

This commit is contained in:
2026-05-24 13:53:03 +08:00
parent afb33d4d5d
commit 7c0ce6fce8
9 changed files with 198 additions and 23 deletions
+4 -4
View File
@@ -4,10 +4,10 @@ import "time"
// User 用户实体。
type User struct {
ID uint `json:"id"`
Username string `json:"username"`
Password string `json:"-"` // 密码哈希,JSON 序列化时忽略
Email string `json:"email,omitempty"`
ID uint `json:"id" gorm:"primaryKey"`
Username string `json:"username" gorm:"uniqueIndex;size:32"`
Password string `json:"-"`
Email string `json:"email,omitempty" gorm:"size:128"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}