Files
open-im-server/pkg/common/db/table/unrelation/super_group.go
T

40 lines
1.3 KiB
Go
Raw Normal View History

2023-02-03 12:16:48 +08:00
package unrelation
2023-02-08 17:56:04 +08:00
import (
"context"
)
2023-02-07 18:43:43 +08:00
2023-02-03 12:16:48 +08:00
const (
CSuperGroup = "super_group"
CUserToSuperGroup = "user_to_super_group"
)
type SuperGroupModel struct {
GroupID string `bson:"group_id" json:"groupID"`
MemberIDs []string `bson:"member_id_list" json:"memberIDList"`
}
func (SuperGroupModel) TableName() string {
return CSuperGroup
}
type UserToSuperGroupModel struct {
UserID string `bson:"user_id" json:"userID"`
GroupIDs []string `bson:"group_id_list" json:"groupIDList"`
}
func (UserToSuperGroupModel) TableName() string {
return CUserToSuperGroup
}
type SuperGroupModelInterface interface {
2023-02-20 17:43:09 +08:00
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string) error
TakeSuperGroup(ctx context.Context, groupID string) (group *SuperGroupModel, err error)
FindSuperGroup(ctx context.Context, groupIDs []string) (groups []*SuperGroupModel, err error)
AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error
RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string) error
GetSuperGroupByUserID(ctx context.Context, userID string) (*UserToSuperGroupModel, error)
DeleteSuperGroup(ctx context.Context, groupID string) error
RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string) error
2023-02-03 12:16:48 +08:00
}