You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
2.0 KiB
41 lines
2.0 KiB
1 year ago
|
// Copyright © 2023 OpenIM. All rights reserved.
|
||
|
//
|
||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
// you may not use this file except in compliance with the License.
|
||
|
// You may obtain a copy of the License at
|
||
|
//
|
||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||
|
//
|
||
|
// Unless required by applicable law or agreed to in writing, software
|
||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
// See the License for the specific language governing permissions and
|
||
|
// limitations under the License.
|
||
|
|
||
7 months ago
|
package database
|
||
1 year ago
|
|
||
|
import (
|
||
|
"context"
|
||
7 months ago
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||
8 months ago
|
"github.com/openimsdk/tools/db/pagination"
|
||
1 year ago
|
)
|
||
1 year ago
|
|
||
7 months ago
|
type FriendRequest interface {
|
||
1 year ago
|
// Insert multiple records
|
||
7 months ago
|
Create(ctx context.Context, friendRequests []*model.FriendRequest) (err error)
|
||
1 year ago
|
// Delete record
|
||
1 year ago
|
Delete(ctx context.Context, fromUserID, toUserID string) (err error)
|
||
1 year ago
|
// Update with zero values
|
||
|
UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]any) (err error)
|
||
|
// Update multiple records (non-zero values)
|
||
7 months ago
|
Update(ctx context.Context, friendRequest *model.FriendRequest) (err error)
|
||
1 year ago
|
// Get friend requests sent to a specific user, no error returned if not found
|
||
7 months ago
|
Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *model.FriendRequest, err error)
|
||
|
Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *model.FriendRequest, err error)
|
||
1 year ago
|
// Get list of friend requests received by toUserID
|
||
7 months ago
|
FindToUserID(ctx context.Context, toUserID string, pagination pagination.Pagination) (total int64, friendRequests []*model.FriendRequest, err error)
|
||
1 year ago
|
// Get list of friend requests sent by fromUserID
|
||
7 months ago
|
FindFromUserID(ctx context.Context, fromUserID string, pagination pagination.Pagination) (total int64, friendRequests []*model.FriendRequest, err error)
|
||
|
FindBothFriendRequests(ctx context.Context, fromUserID, toUserID string) (friends []*model.FriendRequest, err error)
|
||
1 year ago
|
}
|