We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a962bf commit 32fdd30Copy full SHA for 32fdd30
1 file changed
msq/connection.go
@@ -3,6 +3,7 @@ package msq
3
import (
4
"errors"
5
"fmt"
6
+ "strconv"
7
8
"github.com/jinzhu/gorm"
9
_ "github.com/jinzhu/gorm/dialects/mysql"
@@ -12,6 +13,7 @@ import (
12
13
type ConnectionConfig struct {
14
Type string
15
Host string
16
+ Port int
17
Username string
18
Password string
19
Database string
@@ -73,10 +75,11 @@ func (c *Connection) getConnectionString() string {
73
75
74
76
if dbType == "mysql" {
77
return fmt.Sprintf(
- "%s:%s@%s/%s?charset=%s&parseTime=True&loc=%s",
78
+ "%s:%s@tcp(%s:%s)/%s?charset=%s&parseTime=True&loc=%s",
79
c.Config.Username,
80
c.Config.Password,
81
c.Config.Host,
82
+ strconv.Itoa(c.Config.Port),
83
c.Config.Database,
84
c.Config.Charset,
85
c.Config.Locale,
0 commit comments