Skip to content

Commit

Permalink
feat: expose normalizeSynonyms
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored and sio4 committed Jun 3, 2022
1 parent 3afc531 commit 59e3ada
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions connection_details.go
Expand Up @@ -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 = NormalizeDialectSynonyms(dialect)
} else {
return errors.New("no dialect provided, and could not guess it from URL")
}
Expand Down Expand Up @@ -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 = NormalizeDialectSynonyms(cd.Dialect)

if cd.Options == nil { // for safety
cd.Options = make(map[string]string)
Expand Down
2 changes: 1 addition & 1 deletion connection_instrumented.go
Expand Up @@ -39,7 +39,7 @@ func instrumentDriver(deets *ConnectionDetails, defaultDriverName string) (drive

var dr driver.Driver
var newDriverName string
switch normalizeSynonyms(driverName) {
switch NormalizeDialectSynonyms(driverName) {
case nameCockroach:
fallthrough
case namePostgreSQL:
Expand Down
2 changes: 1 addition & 1 deletion match.go
Expand Up @@ -26,7 +26,7 @@ func ParseMigrationFilename(filename string) (*Match, error) {
if m[3] == "" {
dbType = "all"
} else {
dbType = normalizeSynonyms(m[3][1:])
dbType = NormalizeDialectSynonyms(m[3][1:])
if !DialectSupported(dbType) {
return nil, fmt.Errorf("unsupported dialect %s", dbType)
}
Expand Down
2 changes: 1 addition & 1 deletion pop.go
Expand Up @@ -56,7 +56,7 @@ func DialectSupported(d string) bool {
return false
}

func normalizeSynonyms(dialect string) string {
func NormalizeDialectSynonyms(dialect string) string {
d := strings.ToLower(dialect)
if syn, ok := dialectSynonyms[d]; ok {
d = syn
Expand Down

0 comments on commit 59e3ada

Please sign in to comment.