mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
chore: tools, pb replaced by public warehouse (#662)
* fix: StringValue When there are double quotes in the string value, serialization and deserialization fail Signed-off-by: withchao <993506633@qq.com> * test: StatusTemporaryRedirect -> StatusFound Signed-off-by: withchao <993506633@qq.com> * chore: pb a2r Signed-off-by: withchao <993506633@qq.com> * chore: replacement package Signed-off-by: withchao <993506633@qq.com> * chore: replacement package Signed-off-by: withchao <993506633@qq.com> * chore: replacement package Signed-off-by: withchao <993506633@qq.com> * fix: remove go mod replace Signed-off-by: withchao <993506633@qq.com> * fix: tools version Signed-off-by: withchao <993506633@qq.com> * fix: config.yaml Signed-off-by: withchao <993506633@qq.com> --------- Signed-off-by: withchao <993506633@qq.com>
This commit is contained in:
@@ -17,18 +17,18 @@ package unrelation
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw/specialerror"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/mw/specialerror"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -111,13 +111,15 @@ func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...strin
|
||||
db := m.db.Database(config.Config.Mongo.Database).Collection(collection)
|
||||
opts := options.CreateIndexes().SetMaxTime(10 * time.Second)
|
||||
indexView := db.Indexes()
|
||||
keysDoc := bsonx.Doc{}
|
||||
keysDoc := bson.D{}
|
||||
// create composite indexes
|
||||
for _, key := range keys {
|
||||
if strings.HasPrefix(key, "-") {
|
||||
keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
|
||||
keysDoc = append(keysDoc, bson.E{Key: strings.TrimLeft(key, "-"), Value: -1})
|
||||
//keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
|
||||
} else {
|
||||
keysDoc = keysDoc.Append(key, bsonx.Int32(1))
|
||||
keysDoc = append(keysDoc, bson.E{Key: key, Value: 1})
|
||||
//keysDoc = keysDoc.Append(key, bsonx.Int32(1))
|
||||
}
|
||||
}
|
||||
// create index
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@@ -32,9 +32,9 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
func NewSuperGroupMongoDriver(database *mongo.Database) unrelation.SuperGroupModelInterface {
|
||||
|
||||
Reference in New Issue
Block a user