mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-30 16:02:17 +08:00 
			
		
		
		
	* pb * fix: Modifying other fields while setting IsPrivateChat does not take effect * fix: quote message error revoke * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * upgrading pkg tools * fix * fix * optimize log output * feat: support GetLastMessage * feat: support GetLastMessage * feat: s3 switch * feat: s3 switch * fix: GetUsersOnline * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: seq conversion failed without exiting * monolithic * fix: DeleteDoc crash * fix: DeleteDoc crash * fix: monolithic * fix: monolithic * fix: fill send time * fix: fill send time * fix: crash caused by withdrawing messages from users who have left the group * fix: mq * fix: mq * fix: user msg timestamp * fix: mq * 1 * 1 * 1 * 1 * 1 * 1 * 1 * seq read config * seq read config * 1 * 1 * fix: the source message of the reference is withdrawn, and the referenced message is deleted * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package mgo
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"testing"
 | |
| 	"time"
 | |
| 
 | |
| 	"go.mongodb.org/mongo-driver/mongo"
 | |
| 	"go.mongodb.org/mongo-driver/mongo/options"
 | |
| )
 | |
| 
 | |
| func Result[V any](val V, err error) V {
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	return val
 | |
| }
 | |
| 
 | |
| func Mongodb() *mongo.Database {
 | |
| 	return Result(
 | |
| 		mongo.Connect(context.Background(),
 | |
| 			options.Client().
 | |
| 				ApplyURI("mongodb://openIM:openIM123@172.16.8.135:37017/openim_v3?maxPoolSize=100").
 | |
| 				SetConnectTimeout(5*time.Second)),
 | |
| 	).Database("openim_v3")
 | |
| }
 | |
| 
 | |
| func TestUserSeq(t *testing.T) {
 | |
| 	uSeq := Result(NewSeqUserMongo(Mongodb())).(*seqUserMongo)
 | |
| 	t.Log(uSeq.SetUserMinSeq(context.Background(), "1000", "2000", 4))
 | |
| }
 | |
| 
 | |
| func TestConversationSeq(t *testing.T) {
 | |
| 	cSeq := Result(NewSeqConversationMongo(Mongodb())).(*seqConversationMongo)
 | |
| 	t.Log(cSeq.SetMaxSeq(context.Background(), "2000", 10))
 | |
| 	t.Log(cSeq.Malloc(context.Background(), "2000", 10))
 | |
| 	t.Log(cSeq.GetMaxSeq(context.Background(), "2000"))
 | |
| }
 | |
| 
 | |
| func TestUserGetUserReadSeqs(t *testing.T) {
 | |
| 	uSeq := Result(NewSeqUserMongo(Mongodb())).(*seqUserMongo)
 | |
| 	t.Log(uSeq.GetUserReadSeqs(context.Background(), "2110910952", []string{"sg_345762580", "2000", "3000"}))
 | |
| }
 |