Skip to content

Commit

Permalink
Creating DSN using database name.
Browse files Browse the repository at this point in the history
Signed-off-by: Beniamin Kalinowski <[email protected]>
  • Loading branch information
BeniaminK committed Jan 18, 2025
1 parent b51a99c commit 53b00ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type MySqlConfig struct {
User string `ini:"user"`
Password string `ini:"password"`
Host string `ini:"host"`
Database string `ini:"database"`
Port int `ini:"port"`
Socket string `ini:"socket"`
SslCa string `ini:"ssl-ca"`
Expand Down Expand Up @@ -166,6 +167,7 @@ func (m MySqlConfig) FormDSN(target string) (string, error) {
config := mysql.NewConfig()
config.User = m.User
config.Passwd = m.Password
config.DBName = m.Database
config.Net = "tcp"
if target == "" {
if m.Socket == "" {
Expand Down

0 comments on commit 53b00ec

Please sign in to comment.