Skip to content

Commit

Permalink
define default driver name constant (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoManito authored Jun 12, 2024
1 parent 9d1b8d6 commit 361eb5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
)

const (
DefaultDriverName = "mysql"

AutoRandomTag = "auto_random()" // Treated as an auto_random field for tidb
)

Expand Down Expand Up @@ -80,7 +82,7 @@ func New(config Config) gorm.Dialector {
}

func (dialector Dialector) Name() string {
return "mysql"
return DefaultDriverName
}

// NowFunc return now func
Expand All @@ -107,7 +109,7 @@ func (dialector Dialector) Apply(config *gorm.Config) error {

func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
if dialector.DriverName == "" {
dialector.DriverName = "mysql"
dialector.DriverName = DefaultDriverName
}

if dialector.DefaultDatetimePrecision == nil {
Expand Down

0 comments on commit 361eb5f

Please sign in to comment.