From 14d9dfa1095691372dd606dc51e60e98aa064ae8 Mon Sep 17 00:00:00 2001 From: dm-2 <45519614+dm-2@users.noreply.github.com> Date: Wed, 25 Jan 2023 10:43:14 +0000 Subject: [PATCH] make getBackendDBUri private --- pkg/group/mysql.go | 4 ++-- pkg/group/mysql_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/group/mysql.go b/pkg/group/mysql.go index ff8991f..a2fab61 100644 --- a/pkg/group/mysql.go +++ b/pkg/group/mysql.go @@ -77,7 +77,7 @@ func NewMySQLBackend(throttler *throttle.Throttler) (*MySQLBackend, error) { if config.Settings().BackendMySQLHost == "" { return nil, nil } - dbUri := GetBackendDBUri() + dbUri := getBackendDBUri() db, _, err := sqlutils.GetDB(dbUri) if err != nil { return nil, err @@ -107,7 +107,7 @@ func NewMySQLBackend(throttler *throttle.Throttler) (*MySQLBackend, error) { } // helper function to get the DB URI -func GetBackendDBUri() string { +func getBackendDBUri() string { dsnCharsetCollation := "charset=utf8mb4,utf8,latin1" if config.Settings().BackendMySQLCollation != "" { // Set collation instead of charset, if BackendMySQLCollation is specified diff --git a/pkg/group/mysql_test.go b/pkg/group/mysql_test.go index 3ca3765..1049b38 100644 --- a/pkg/group/mysql_test.go +++ b/pkg/group/mysql_test.go @@ -25,11 +25,11 @@ func TestGetBackendDBUri(t *testing.T) { config.Settings().BackendMySQLSchema = "test_database" // test default (charset) - dbUri := GetBackendDBUri() + dbUri := getBackendDBUri() test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&charset=utf8mb4,utf8,latin1&timeout=500ms") // test setting collation config.Settings().BackendMySQLCollation = "utf8mb4_unicode_ci" - dbUri = GetBackendDBUri() + dbUri = getBackendDBUri() test.S(t).ExpectEquals(dbUri, "gromit:penguin@tcp(myhost:3306)/test_database?interpolateParams=true&collation=utf8mb4_unicode_ci&timeout=500ms") }