This commit is contained in:
wangchuxiao
2023-01-28 17:09:20 +08:00
parent 7fc279a329
commit 87e61046cb
3 changed files with 41 additions and 34 deletions
+10
View File
@@ -19,6 +19,7 @@ type GroupInterface interface {
TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error)
//mongo
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
}
@@ -51,12 +52,17 @@ func (g *GroupController) GetSuperGroupByID(ctx context.Context, groupID string)
return g.database.GetSuperGroup(ctx, groupID)
}
func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error {
return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList, memberNumCount)
}
type DataBase interface {
Find(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error)
Create(ctx context.Context, groups []*relation.Group) error
Delete(ctx context.Context, groupIDs []string) error
Take(ctx context.Context, groupID string) (group *relation.Group, err error)
GetSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error
}
type GroupDataBase struct {
@@ -120,6 +126,10 @@ func (g *GroupDataBase) Update(ctx context.Context, groups []*relation.Group) er
})
}
func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error {
g.mongoDB.CreateSuperGroup(ctx, groupID, initMemberIDList, memberNumCount)
}
func (g *GroupDataBase) GetSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
return g.mongoDB.GetSuperGroup(ctx, groupID)
}