fix: port in dsn is a number
This commit is contained in:
parent
051cf59195
commit
10060f0245
2
db/db.go
2
db/db.go
|
@ -31,7 +31,7 @@ func NewDatabase(lc fx.Lifecycle, params DatabaseParams) *gorm.DB {
|
||||||
dbname := params.Config.Config().Core.DB.Name
|
dbname := params.Config.Config().Core.DB.Name
|
||||||
charset := params.Config.Config().Core.DB.Charset
|
charset := params.Config.Config().Core.DB.Charset
|
||||||
|
|
||||||
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=%s&parseTime=True&loc=Local", username, password, host, port, dbname, charset)
|
dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=True&loc=Local", username, password, host, port, dbname, charset)
|
||||||
|
|
||||||
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue