From 361eb5f8915096ec10db6d0325d9a3ddcf86f962 Mon Sep 17 00:00:00 2001 From: jessetang <1430482733@qq.com> Date: Wed, 12 Jun 2024 11:48:53 +0800 Subject: [PATCH] define default driver name constant (#155) --- mysql.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql.go b/mysql.go index bdef77b..8b6ef3d 100644 --- a/mysql.go +++ b/mysql.go @@ -22,6 +22,8 @@ import ( ) const ( + DefaultDriverName = "mysql" + AutoRandomTag = "auto_random()" // Treated as an auto_random field for tidb ) @@ -80,7 +82,7 @@ func New(config Config) gorm.Dialector { } func (dialector Dialector) Name() string { - return "mysql" + return DefaultDriverName } // NowFunc return now func @@ -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 {