mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 12:08:52 +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 (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/mw/specialerror"
|
||||||
|
"OpenIM/pkg/errs"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
@ -9,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewRedis() (redis.UniversalClient, error) {
|
func NewRedis() (redis.UniversalClient, error) {
|
||||||
|
specialerror.AddReplace(redis.Nil, errs.ErrRecordNotFound)
|
||||||
var rdb redis.UniversalClient
|
var rdb redis.UniversalClient
|
||||||
if config.Config.Redis.EnableCluster {
|
if config.Config.Redis.EnableCluster {
|
||||||
rdb = redis.NewClusterClient(&redis.ClusterOptions{
|
rdb = redis.NewClusterClient(&redis.ClusterOptions{
|
||||||
|
@ -3,6 +3,8 @@ package relation
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
|
"OpenIM/pkg/common/mw/specialerror"
|
||||||
|
"OpenIM/pkg/errs"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
@ -62,6 +64,7 @@ func newMysqlGormDB() (*gorm.DB, error) {
|
|||||||
|
|
||||||
// gorm mysql
|
// gorm mysql
|
||||||
func NewGormDB() (*gorm.DB, error) {
|
func NewGormDB() (*gorm.DB, error) {
|
||||||
|
specialerror.AddReplace(gorm.ErrRecordNotFound, errs.ErrRecordNotFound)
|
||||||
return newMysqlGormDB()
|
return newMysqlGormDB()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package unrelation
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/db/table/unrelation"
|
"OpenIM/pkg/common/db/table/unrelation"
|
||||||
|
"OpenIM/pkg/common/mw/specialerror"
|
||||||
|
"OpenIM/pkg/errs"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -18,6 +20,7 @@ type Mongo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewMongo() (*Mongo, error) {
|
func NewMongo() (*Mongo, error) {
|
||||||
|
specialerror.AddReplace(mongo.ErrNoDocuments, errs.ErrRecordNotFound)
|
||||||
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
||||||
if config.Config.Mongo.DBUri != "" {
|
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
|
// 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