Skip to content

Commit 3890243

Browse files
committed
fix: new mysql db client
1 parent 37fb4ee commit 3890243

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dskit/mysql/mysql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ func (m *MySQL) NewConn(ctx context.Context, database string) (*gorm.DB, error)
115115
}()
116116

117117
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True", shard.User, shard.Password, shard.Addr, database)
118-
119-
return sqlbase.NewDB(
118+
db, err = sqlbase.NewDB(
120119
ctx,
121120
mysql.Open(dsn),
122121
shard.MaxIdleConns,
123122
shard.MaxOpenConns,
124123
time.Duration(shard.ConnMaxLifetime)*time.Second,
125124
)
125+
return db, err
126126
}
127127

128128
func (m *MySQL) ShowDatabases(ctx context.Context) ([]string, error) {

0 commit comments

Comments
 (0)