mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
special error
This commit is contained in:
parent
351b59020d
commit
6d03169f12
3
pkg/common/db/cache/init_redis.go
vendored
3
pkg/common/db/cache/init_redis.go
vendored
@ -2,6 +2,8 @@ package cache
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/mw/specialerror"
|
||||
"OpenIM/pkg/errs"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/go-redis/redis/v8"
|
||||
@ -9,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func NewRedis() (redis.UniversalClient, error) {
|
||||
specialerror.AddReplace(redis.Nil, errs.ErrRecordNotFound)
|
||||
var rdb redis.UniversalClient
|
||||
if config.Config.Redis.EnableCluster {
|
||||
rdb = redis.NewClusterClient(&redis.ClusterOptions{
|
||||
|
@ -3,6 +3,8 @@ package relation
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/mw/specialerror"
|
||||
"OpenIM/pkg/errs"
|
||||
"context"
|
||||
"fmt"
|
||||
"gorm.io/driver/mysql"
|
||||
@ -62,6 +64,7 @@ func newMysqlGormDB() (*gorm.DB, error) {
|
||||
|
||||
// gorm mysql
|
||||
func NewGormDB() (*gorm.DB, error) {
|
||||
specialerror.AddReplace(gorm.ErrRecordNotFound, errs.ErrRecordNotFound)
|
||||
return newMysqlGormDB()
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ package unrelation
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/db/table/unrelation"
|
||||
"OpenIM/pkg/common/mw/specialerror"
|
||||
"OpenIM/pkg/errs"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
@ -18,6 +20,7 @@ type Mongo struct {
|
||||
}
|
||||
|
||||
func NewMongo() (*Mongo, error) {
|
||||
specialerror.AddReplace(mongo.ErrNoDocuments, errs.ErrRecordNotFound)
|
||||
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
||||
if config.Config.Mongo.DBUri != "" {
|
||||
// example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize
|
||||
|
Loading…
x
Reference in New Issue
Block a user