用户模块
This commit is contained in:
21
acquaintances/biz/model/user_relations.go
Normal file
21
acquaintances/biz/model/user_relations.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Friendship 好友关系表
|
||||
type UserRelations struct {
|
||||
gorm.Model
|
||||
UserID string `gorm:"type:bigint;not null;index:idx_user_status;column:用户id;"`
|
||||
FriendID string `gorm:"type:bigint;not null;index:idx_friend_status;column:好友id"`
|
||||
Status uint8 `gorm:"type:tinyint;default:0;column:关系状态"` // 0: 待确认, 1: 已确认, 2: 已拒绝, 3: 已删除
|
||||
|
||||
// 关联用户
|
||||
User *User `gorm:"foreignKey:UserID;references:UserID"`
|
||||
Friend *User `gorm:"foreignKey:FriendID;references:UserID"`
|
||||
}
|
||||
|
||||
func (u *UserRelations) TableName() string {
|
||||
return "user_relations"
|
||||
}
|
Reference in New Issue
Block a user