rpc GroupApplicationResponse

This commit is contained in:
withchao
2023-02-06 15:32:20 +08:00
parent 49983b8c83
commit 210d04d488
7 changed files with 97 additions and 71 deletions
+6 -2
View File
@@ -4,6 +4,7 @@ import (
"Open_IM/pkg/common/db/cache"
"Open_IM/pkg/common/db/relation"
relation2 "Open_IM/pkg/common/db/table/relation"
unrelation2 "Open_IM/pkg/common/db/table/unrelation"
"Open_IM/pkg/common/db/unrelation"
"context"
"github.com/dtm-labs/rockscache"
@@ -18,7 +19,7 @@ type GroupInterface interface {
CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error)
TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupModel, err error)
TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error)
GetJoinedGroupList(ctx context.Context, userID string) ([]*relation2.GroupModel, error)
GetGroupMemberList(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error)
GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
@@ -32,11 +33,14 @@ type GroupInterface interface {
CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error
CreateGroupRequest(ctx context.Context, requests []*relation2.GroupRequestModel) error
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error)
//mongo
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
DelSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error
AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error)
}
var _ GroupInterface = (*GroupController)(nil)
+5 -5
View File
@@ -67,7 +67,7 @@ func DeleteAt[E any](es *[]E, index ...int) []E {
}
// IndexAny get the index of the element
func IndexAny[E any, K comparable](es []E, e E, fn func(e E) K) int {
func IndexAny[E any, K comparable](e E, es []E, fn func(e E) K) int {
k := fn(e)
for i := 0; i < len(es); i++ {
if fn(es[i]) == k {
@@ -78,15 +78,15 @@ func IndexAny[E any, K comparable](es []E, e E, fn func(e E) K) int {
}
// IndexOf get the index of the element
func IndexOf[E comparable](es []E, e E) int {
return IndexAny(es, e, func(t E) E {
func IndexOf[E comparable](e E, es ...E) int {
return IndexAny(e, es, func(t E) E {
return t
})
}
// Contain 是否包含
func Contain[E comparable](es []E, e E) bool {
return IndexOf(es, e) >= 0
func Contain[E comparable](e E, es ...E) bool {
return IndexOf(e, es...) >= 0
}
// DuplicateAny 是否有重复的