mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-08 19:45:22 +08:00
1
This commit is contained in:
parent
d5a9647902
commit
8e49d7e567
67
pkg/common/db/table/group.go
Normal file
67
pkg/common/db/table/group.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package table
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
GroupTableName = "groups"
|
||||||
|
GroupMemberTableName = "group_members"
|
||||||
|
GroupRequestTableName = "group_requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GroupModel struct {
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
|
||||||
|
GroupName string `gorm:"column:name;size:255" json:"groupName"`
|
||||||
|
Notification string `gorm:"column:notification;size:255" json:"notification"`
|
||||||
|
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
|
||||||
|
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
||||||
|
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
|
||||||
|
Status int32 `gorm:"column:status"`
|
||||||
|
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
|
||||||
|
GroupType int32 `gorm:"column:group_type"`
|
||||||
|
NeedVerification int32 `gorm:"column:need_verification"`
|
||||||
|
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
|
||||||
|
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
||||||
|
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
||||||
|
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GroupModel) TableName() string {
|
||||||
|
return GroupTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupMemberModel struct {
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
||||||
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
|
Nickname string `gorm:"column:nickname;size:255"`
|
||||||
|
FaceURL string `gorm:"column:user_group_face_url;size:255"`
|
||||||
|
RoleLevel int32 `gorm:"column:role_level"`
|
||||||
|
JoinTime time.Time `gorm:"column:join_time"`
|
||||||
|
JoinSource int32 `gorm:"column:join_source"`
|
||||||
|
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
||||||
|
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
||||||
|
MuteEndTime time.Time `gorm:"column:mute_end_time"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GroupMemberModel) TableName() string {
|
||||||
|
return GroupMemberTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupRequestModel struct {
|
||||||
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
||||||
|
HandleResult int32 `gorm:"column:handle_result"`
|
||||||
|
ReqMsg string `gorm:"column:req_msg;size:1024"`
|
||||||
|
HandledMsg string `gorm:"column:handle_msg;size:1024"`
|
||||||
|
ReqTime time.Time `gorm:"column:req_time"`
|
||||||
|
HandleUserID string `gorm:"column:handle_user_id;size:64"`
|
||||||
|
HandledTime time.Time `gorm:"column:handle_time"`
|
||||||
|
JoinSource int32 `gorm:"column:join_source"`
|
||||||
|
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GroupRequestModel) TableName() string {
|
||||||
|
return GroupRequestTableName
|
||||||
|
}
|
@ -39,49 +39,6 @@ type ConversationModel struct {
|
|||||||
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupModel struct {
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
|
|
||||||
GroupName string `gorm:"column:name;size:255" json:"groupName"`
|
|
||||||
Notification string `gorm:"column:notification;size:255" json:"notification"`
|
|
||||||
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
|
|
||||||
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
|
||||||
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
|
|
||||||
Status int32 `gorm:"column:status"`
|
|
||||||
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
|
|
||||||
GroupType int32 `gorm:"column:group_type"`
|
|
||||||
NeedVerification int32 `gorm:"column:need_verification"`
|
|
||||||
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
|
|
||||||
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
|
||||||
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
|
||||||
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *GroupModel) EqID(i interface{}) bool {
|
|
||||||
switch v := i.(type) {
|
|
||||||
case GroupModel:
|
|
||||||
return f.GroupID == v.GroupID
|
|
||||||
case *GroupModel:
|
|
||||||
return f.GroupID == v.GroupID
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func DuplicateRemoval[T any](arr []T, fn func(t T) string) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func aaa() {
|
|
||||||
DuplicateRemoval([]GroupModel{}, func(t GroupModel) string {
|
|
||||||
return t.GroupID
|
|
||||||
})
|
|
||||||
|
|
||||||
DuplicateRemoval([]*GroupModel{}, func(t *GroupModel) string {
|
|
||||||
return t.GroupID
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
type FriendRequestModel struct {
|
type FriendRequestModel struct {
|
||||||
FromUserID string `gorm:"column:from_user_id;primary_key;size:64"`
|
FromUserID string `gorm:"column:from_user_id;primary_key;size:64"`
|
||||||
ToUserID string `gorm:"column:to_user_id;primary_key;size:64"`
|
ToUserID string `gorm:"column:to_user_id;primary_key;size:64"`
|
||||||
@ -94,34 +51,6 @@ type FriendRequestModel struct {
|
|||||||
Ex string `gorm:"column:ex;size:1024"`
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupMemberModel struct {
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
|
||||||
Nickname string `gorm:"column:nickname;size:255"`
|
|
||||||
FaceURL string `gorm:"column:user_group_face_url;size:255"`
|
|
||||||
RoleLevel int32 `gorm:"column:role_level"`
|
|
||||||
JoinTime time.Time `gorm:"column:join_time"`
|
|
||||||
JoinSource int32 `gorm:"column:join_source"`
|
|
||||||
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
|
||||||
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
|
||||||
MuteEndTime time.Time `gorm:"column:mute_end_time"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupRequestModel struct {
|
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
|
||||||
HandleResult int32 `gorm:"column:handle_result"`
|
|
||||||
ReqMsg string `gorm:"column:req_msg;size:1024"`
|
|
||||||
HandledMsg string `gorm:"column:handle_msg;size:1024"`
|
|
||||||
ReqTime time.Time `gorm:"column:req_time"`
|
|
||||||
HandleUserID string `gorm:"column:handle_user_id;size:64"`
|
|
||||||
HandledTime time.Time `gorm:"column:handle_time"`
|
|
||||||
JoinSource int32 `gorm:"column:join_source"`
|
|
||||||
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
type UserModel struct {
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
Nickname string `gorm:"column:name;size:255"`
|
Nickname string `gorm:"column:name;size:255"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user