feat(auth+db): 实现注册登录核心逻辑,以及自动建表,用户信息落库
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user