增加社交信息model
This commit is contained in:
@@ -6,6 +6,15 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ContactInfo 存储用户的多种联系方式
|
||||
// 使用 jsonb 类型存入数据库
|
||||
type ContactInfo struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
WeChat string `json:"wechat,omitempty"`
|
||||
Feishu string `json:"feishu,omitempty"`
|
||||
}
|
||||
|
||||
// User 代表系统中的用户模型
|
||||
type User struct {
|
||||
// gorm.Model 内嵌了 ID, CreatedAt, UpdatedAt, 和 DeletedAt
|
||||
@@ -19,6 +28,9 @@ type User struct {
|
||||
// Password 存储的是加密后的密码哈希,而不是明文
|
||||
// json:"-" 标签确保此字段在序列化为 JSON 时被忽略,防止密码泄露
|
||||
Password string `gorm:"not null" json:"-"`
|
||||
|
||||
// Contact 存储用户的联系方式,以 JSONB 格式存入数据库
|
||||
Contact ContactInfo `gorm:"type:jsonb" json:"contact"`
|
||||
}
|
||||
|
||||
// TableName 自定义 User 模型对应的数据库表名
|
||||
|
||||
Reference in New Issue
Block a user