Skip to content

Commit

Permalink
chore: code style (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
a631807682 committed Apr 14, 2022
1 parent 8e32323 commit cba9d7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions migrator.go
Expand Up @@ -363,7 +363,7 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType,
}

if column.DefaultValueValue.Valid {
column.DefaultValueValue.String = regexp.MustCompile("'(.*)'::[\\w]+$").ReplaceAllString(column.DefaultValueValue.String, "$1")
column.DefaultValueValue.String = regexp.MustCompile(`'(.*)'::[\w]+$`).ReplaceAllString(column.DefaultValueValue.String, "$1")
}

if datetimePrecision.Valid {
Expand Down Expand Up @@ -453,10 +453,8 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType,

func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Rows, error) {
name := table.(string)
if currentSchema != nil {
if _, ok := currentSchema.(string); ok {
name = fmt.Sprintf("%v.%v", currentSchema, table)
}
if _, ok := currentSchema.(string); ok {
name = fmt.Sprintf("%v.%v", currentSchema, table)
}
return m.DB.Session(&gorm.Session{}).Table(name).Limit(1).Rows()
}
Expand Down
2 changes: 1 addition & 1 deletion postgres.go
Expand Up @@ -138,7 +138,7 @@ func (dialector Dialector) QuoteTo(writer clause.Writer, str string) {
writer.WriteByte('"')
}

var numericPlaceholder = regexp.MustCompile("\\$(\\d+)")
var numericPlaceholder = regexp.MustCompile(`\$(\d+)`)

func (dialector Dialector) Explain(sql string, vars ...interface{}) string {
return logger.ExplainSQL(sql, numericPlaceholder, `'`, vars...)
Expand Down

0 comments on commit cba9d7b

Please sign in to comment.