Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions internal/group/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ package group

import (
"context"
"errors"
"time"

"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
"github.com/openimsdk/tools/errs"
"gorm.io/gorm"

"github.com/openimsdk/tools/utils/datautil"

Expand Down Expand Up @@ -177,6 +179,17 @@ func (g *Group) GetJoinedGroupList(ctx context.Context) ([]*model_struct.LocalGr
}

func (g *Group) GetJoinedGroupListPage(ctx context.Context, offset, count int32) ([]*model_struct.LocalGroup, error) {
res, err := g.getJoinedGroupListPage(ctx, offset, count)
if err != nil {
if errs.ErrRecordNotFound.Is(err) || errors.Is(err, gorm.ErrRecordNotFound) {
return []*model_struct.LocalGroup{}, nil
}
return nil, err
}
return res, nil
}

func (g *Group) getJoinedGroupListPage(ctx context.Context, offset, count int32) ([]*model_struct.LocalGroup, error) {
dataFetcher := datafetcher.NewDataFetcher(
g.db,
g.groupTableName(),
Expand Down
14 changes: 14 additions & 0 deletions internal/relation/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package relation

import (
"context"
"errors"

"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
"github.com/openimsdk/protocol/relation"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/utils/datautil"
"gorm.io/gorm"

"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
"github.com/openimsdk/openim-sdk-core/v3/pkg/datafetcher"
Expand Down Expand Up @@ -186,6 +189,17 @@ func (r *Relation) GetFriendList(ctx context.Context, filterBlack bool) ([]*mode
}

func (r *Relation) GetFriendListPage(ctx context.Context, offset, count int32, filterBlack bool) ([]*model_struct.LocalFriend, error) {
res, err := r.getFriendListPage(ctx, offset, count, filterBlack)
if err != nil {
if errs.ErrRecordNotFound.Is(err) || errors.Is(err, gorm.ErrRecordNotFound) {
return []*model_struct.LocalFriend{}, nil
}
return nil, err
}
return res, nil
}

func (r *Relation) getFriendListPage(ctx context.Context, offset, count int32, filterBlack bool) ([]*model_struct.LocalFriend, error) {
dataFetcher := datafetcher.NewDataFetcher(
r.db,
r.friendListTableName(),
Expand Down
Loading