Skip to content

Commit 361eb5f

Browse files
authored
define default driver name constant (#155)
1 parent 9d1b8d6 commit 361eb5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mysql.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
)
2323

2424
const (
25+
DefaultDriverName = "mysql"
26+
2527
AutoRandomTag = "auto_random()" // Treated as an auto_random field for tidb
2628
)
2729

@@ -80,7 +82,7 @@ func New(config Config) gorm.Dialector {
8082
}
8183

8284
func (dialector Dialector) Name() string {
83-
return "mysql"
85+
return DefaultDriverName
8486
}
8587

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

108110
func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
109111
if dialector.DriverName == "" {
110-
dialector.DriverName = "mysql"
112+
dialector.DriverName = DefaultDriverName
111113
}
112114

113115
if dialector.DefaultDatetimePrecision == nil {

0 commit comments

Comments
 (0)