style: add format and lint (#773)

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong
2023-08-04 21:38:30 +08:00
committed by GitHub
parent 863c52c7bb
commit af00960ad1
132 changed files with 679 additions and 244 deletions
+7 -5
View File
@@ -17,18 +17,20 @@ package unrelation
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"strings"
"time"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mw/specialerror"
"github.com/OpenIMSDK/tools/utils"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
const (
@@ -116,10 +118,10 @@ func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...strin
for _, key := range keys {
if strings.HasPrefix(key, "-") {
keysDoc = append(keysDoc, bson.E{Key: strings.TrimLeft(key, "-"), Value: -1})
//keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
// keysDoc = keysDoc.Append(strings.TrimLeft(key, "-"), bsonx.Int32(-1))
} else {
keysDoc = append(keysDoc, bson.E{Key: key, Value: 1})
//keysDoc = keysDoc.Append(key, bsonx.Int32(1))
// keysDoc = keysDoc.Append(key, bsonx.Int32(1))
}
}
// create index
+2 -1
View File
@@ -31,10 +31,11 @@ import (
"go.mongodb.org/mongo-driver/mongo/options"
"google.golang.org/protobuf/proto"
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/utils"
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
+2 -1
View File
@@ -21,8 +21,9 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
"github.com/OpenIMSDK/tools/utils"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
)
func NewSuperGroupMongoDriver(database *mongo.Database) unrelation.SuperGroupModelInterface {