增加数据库连接池配置
This commit is contained in:
parent
0005d1e8f7
commit
2b23dd7714
@ -133,6 +133,15 @@ func (dc *DBClient) GetDatabaseClient(conf *define.Driver, logInstance *zap.Logg
|
|||||||
return nil, fmt.Errorf("%v : db driver is not support", conf.DBType)
|
return nil, fmt.Errorf("%v : db driver is not support", conf.DBType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbInstance, _ := instance.DB()
|
||||||
|
if nil == conf.Connection {
|
||||||
|
conf.Connection = &define.Connection{
|
||||||
|
MaxOpen: 100,
|
||||||
|
MaxIdle: 100,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dbInstance.SetMaxIdleConns(conf.Connection.MaxIdle)
|
||||||
|
dbInstance.SetMaxOpenConns(conf.Connection.MaxOpen)
|
||||||
instance.Logger = wrapper.NewGormLoggerWithInstance(nil, instance, logInstance, "", nil)
|
instance.Logger = wrapper.NewGormLoggerWithInstance(nil, instance, logInstance, "", nil)
|
||||||
|
|
||||||
return instance, nil
|
return instance, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user