升级 install 能力, 支持sqlite

This commit is contained in:
2024-06-17 16:30:41 +08:00
parent da7c75526a
commit 24aa0d3f9b
7 changed files with 64 additions and 15 deletions

View File

@ -234,11 +234,11 @@ func (c *client) GetDatabaseClient(conf *Driver, logInstance *zap.Logger) (*gorm
err error
)
if conf.DBType == DriverTypeMysql {
if conf.DBType == consts.DatabaseDriverMysql {
if instance, err = gorm.Open(mysql.Open(c.buildConnectionDSN(conf)), &gorm.Config{}); nil != err {
return nil, err
}
} else if conf.DBType == DriverTypeSqlite3 {
} else if conf.DBType == consts.DatabaseDriverSqlite3 {
if instance, err = gorm.Open(sqlite.Open(c.buildConnectionDSN(conf)), &gorm.Config{}); nil != err {
return nil, err
}
@ -257,7 +257,7 @@ func (c *client) GetDatabaseClient(conf *Driver, logInstance *zap.Logger) (*gorm
//
// Date : 18:42 2022/6/11
func (c *client) buildConnectionDSN(conf *Driver) string {
if conf.DBType == DriverTypeSqlite3 {
if conf.DBType == consts.DatabaseDriverSqlite3 {
// 兼容sqlite3
return conf.Host
}