diff --git a/connection_details.go b/connection_details.go index 50c2fe4b..35c1b761 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 = CanonicalDialect(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 = CanonicalDialect(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 435b50db..e38eee7b 100644 --- a/connection_instrumented.go +++ b/connection_instrumented.go @@ -39,7 +39,7 @@ func instrumentDriver(deets *ConnectionDetails, defaultDriverName string) (drive var dr driver.Driver var newDriverName string - switch normalizeSynonyms(driverName) { + switch CanonicalDialect(driverName) { case nameCockroach: fallthrough case namePostgreSQL: diff --git a/match.go b/match.go index 045dfe87..37a45940 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 = CanonicalDialect(m[3][1:]) if !DialectSupported(dbType) { return nil, fmt.Errorf("unsupported dialect %s", dbType) } diff --git a/pop.go b/pop.go index 7d0445ee..97d025a7 100644 --- a/pop.go +++ b/pop.go @@ -56,8 +56,8 @@ func DialectSupported(d string) bool { return false } -func normalizeSynonyms(dialect string) string { - d := strings.ToLower(dialect) +func CanonicalDialect(synonym string) string { + d := strings.ToLower(synonym) if syn, ok := dialectSynonyms[d]; ok { d = syn }