From 195240e4a669193bd21c30c0320bdffdbf57a8a1 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 May 2022 18:00:09 +0200 Subject: [PATCH] feat: expose normalizeSynonyms --- connection_details.go | 4 ++-- connection_instrumented.go | 2 +- match.go | 2 +- pop.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/connection_details.go b/connection_details.go index 50c2fe4b4..7ce40b5e1 100644 --- a/connection_details.go +++ b/connection_details.go @@ -78,7 +78,7 @@ func (cd *ConnectionDetails) withURL() error { if dialectX.MatchString(ul) { // Guess the dialect from the scheme dialect := ul[:strings.Index(ul, ":")] - cd.Dialect = normalizeSynonyms(dialect) + cd.Dialect = NormalizeSynonyms(dialect) } else { return errors.New("no dialect provided, and could not guess it from URL") } @@ -125,7 +125,7 @@ func (cd *ConnectionDetails) withURL() error { // Finalize cleans up the connection details by normalizing names, // filling in default values, etc... func (cd *ConnectionDetails) Finalize() error { - cd.Dialect = normalizeSynonyms(cd.Dialect) + cd.Dialect = NormalizeSynonyms(cd.Dialect) if cd.Options == nil { // for safety cd.Options = make(map[string]string) diff --git a/connection_instrumented.go b/connection_instrumented.go index 0118e8484..af974f459 100644 --- a/connection_instrumented.go +++ b/connection_instrumented.go @@ -36,7 +36,7 @@ func instrumentDriver(deets *ConnectionDetails, defaultDriverName string) (drive var dr driver.Driver var newDriverName string - switch normalizeSynonyms(driverName) { + switch NormalizeSynonyms(driverName) { case nameCockroach: fallthrough case namePostgreSQL: diff --git a/match.go b/match.go index 045dfe87f..108160ad3 100644 --- a/match.go +++ b/match.go @@ -26,7 +26,7 @@ func ParseMigrationFilename(filename string) (*Match, error) { if m[3] == "" { dbType = "all" } else { - dbType = normalizeSynonyms(m[3][1:]) + dbType = NormalizeSynonyms(m[3][1:]) if !DialectSupported(dbType) { return nil, fmt.Errorf("unsupported dialect %s", dbType) } diff --git a/pop.go b/pop.go index 7d0445ee8..bf90148c6 100644 --- a/pop.go +++ b/pop.go @@ -56,7 +56,7 @@ func DialectSupported(d string) bool { return false } -func normalizeSynonyms(dialect string) string { +func NormalizeSynonyms(dialect string) string { d := strings.ToLower(dialect) if syn, ok := dialectSynonyms[d]; ok { d = syn