mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 11:22:10 +08:00 
			
		
		
		
	fix: remove unnecessary field.
This commit is contained in:
		
							parent
							
								
									13a92eed6b
								
							
						
					
					
						commit
						a6936f03af
					
				@ -2,6 +2,7 @@ package conversation
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
 | 
			
		||||
	"github.com/openimsdk/open-im-server/v3/internal/rpc/incrversion"
 | 
			
		||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
 | 
			
		||||
	"github.com/openimsdk/open-im-server/v3/pkg/util/hashutil"
 | 
			
		||||
@ -40,7 +41,6 @@ func (c *conversationServer) GetIncrementalConversation(ctx context.Context, req
 | 
			
		||||
		Find: func(ctx context.Context, conversationIDs []string) ([]*conversation.Conversation, error) {
 | 
			
		||||
			return c.getConversations(ctx, req.UserID, conversationIDs)
 | 
			
		||||
		},
 | 
			
		||||
		ID: func(elem *conversation.Conversation) string { return elem.GroupID },
 | 
			
		||||
		Resp: func(version *model.VersionLog, delIDs []string, insertList, updateList []*conversation.Conversation, full bool) *conversation.GetIncrementalConversationResp {
 | 
			
		||||
			return &conversation.GetIncrementalConversationResp{
 | 
			
		||||
				VersionID: version.ID.Hex(),
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,6 @@ func (s *friendServer) GetIncrementalFriends(ctx context.Context, req *relation.
 | 
			
		||||
		Find: func(ctx context.Context, ids []string) ([]*sdkws.FriendInfo, error) {
 | 
			
		||||
			return s.getFriend(ctx, req.UserID, ids)
 | 
			
		||||
		},
 | 
			
		||||
		ID: func(elem *sdkws.FriendInfo) string { return elem.FriendUser.UserID },
 | 
			
		||||
		Resp: func(version *model.VersionLog, deleteIds []string, insertList, updateList []*sdkws.FriendInfo, full bool) *relation.GetIncrementalFriendsResp {
 | 
			
		||||
			return &relation.GetIncrementalFriendsResp{
 | 
			
		||||
				VersionID: version.ID.Hex(),
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ package incrversion
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
 | 
			
		||||
	"github.com/openimsdk/tools/errs"
 | 
			
		||||
	"go.mongodb.org/mongo-driver/bson/primitive"
 | 
			
		||||
@ -20,7 +21,7 @@ const syncLimit = 200
 | 
			
		||||
const (
 | 
			
		||||
	tagQuery = iota + 1
 | 
			
		||||
	tagFull
 | 
			
		||||
	tageEqual
 | 
			
		||||
	tagEqual
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Option[A, B any] struct {
 | 
			
		||||
@ -33,7 +34,6 @@ type Option[A, B any] struct {
 | 
			
		||||
	Version         func(ctx context.Context, dId string, version uint, limit int) (*model.VersionLog, error)
 | 
			
		||||
	//SortID          func(ctx context.Context, dId string) ([]string, error)
 | 
			
		||||
	Find func(ctx context.Context, ids []string) ([]A, error)
 | 
			
		||||
	ID   func(elem A) string
 | 
			
		||||
	Resp func(version *model.VersionLog, deleteIds []string, insertList, updateList []A, full bool) *B
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -60,9 +60,6 @@ func (o *Option[A, B]) check() error {
 | 
			
		||||
	if o.Find == nil {
 | 
			
		||||
		return o.newError("func find is nil")
 | 
			
		||||
	}
 | 
			
		||||
	if o.ID == nil {
 | 
			
		||||
		return o.newError("func id is nil")
 | 
			
		||||
	}
 | 
			
		||||
	if o.Resp == nil {
 | 
			
		||||
		return o.newError("func resp is nil")
 | 
			
		||||
	}
 | 
			
		||||
@ -100,7 +97,7 @@ func (o *Option[A, B]) getVersion(tag *int) (*model.VersionLog, error) {
 | 
			
		||||
			return cache, nil
 | 
			
		||||
		}
 | 
			
		||||
		if o.VersionNumber == uint64(cache.Version) {
 | 
			
		||||
			*tag = tageEqual
 | 
			
		||||
			*tag = tagEqual
 | 
			
		||||
			return cache, nil
 | 
			
		||||
		}
 | 
			
		||||
		*tag = tagQuery
 | 
			
		||||
@ -123,7 +120,7 @@ func (o *Option[A, B]) Build() (*B, error) {
 | 
			
		||||
		full = version.ID.Hex() != o.VersionID || uint64(version.Version) < o.VersionNumber || len(version.Logs) != version.LogLen
 | 
			
		||||
	case tagFull:
 | 
			
		||||
		full = true
 | 
			
		||||
	case tageEqual:
 | 
			
		||||
	case tagEqual:
 | 
			
		||||
		full = false
 | 
			
		||||
	default:
 | 
			
		||||
		panic(fmt.Errorf("undefined tag %d", tag))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user