From 53b00ec565f0cd054a1484437704862a8146862d Mon Sep 17 00:00:00 2001 From: Beniamin Kalinowski Date: Sat, 18 Jan 2025 02:03:28 +0100 Subject: [PATCH] Creating DSN using database name. Signed-off-by: Beniamin Kalinowski --- config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.go b/config/config.go index a6980511..1408f584 100644 --- a/config/config.go +++ b/config/config.go @@ -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"` @@ -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 == "" {