- model/friendship.go: 好友关系模型(双向存储,4 种状态) - model/friend_group.go: 好友分组模型 - constants/contact.go: 好友关系状态常量 - dto/contact_dto.go: 联系人请求/响应 DTO - dao/friendship_dao.go: 好友关系 CRUD + 搜索 + 共同好友 - dao/friend_group_dao.go: 好友分组 CRUD + 移动好友 Made-with: Cursor
17 lines
671 B
Go
17 lines
671 B
Go
package model
|
|
|
|
import "time"
|
|
|
|
// FriendGroup 好友分组模型,对应 contact_groups 表
|
|
type FriendGroup struct {
|
|
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"` // 分组唯一标识
|
|
UserID int64 `gorm:"not null;index:idx_contact_groups_user" json:"user_id"` // 所属用户 ID
|
|
Name string `gorm:"size:50;not null" json:"name"` // 分组名称
|
|
SortOrder int `gorm:"not null;default:0" json:"sort_order"` // 排序权重,越小越靠前
|
|
CreatedAt time.Time `gorm:"not null;autoCreateTime" json:"created_at"` // 创建时间
|
|
}
|
|
|
|
func (FriendGroup) TableName() string {
|
|
return "contact_groups"
|
|
}
|