Skip to content

Commit 323fe90

Browse files
committed
update add mysql allowNativePasswords
1 parent 2473098 commit 323fe90

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

framework/contract/orm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type DBConfig struct {
3838
Password string `yaml:"password"` // 密码
3939
Driver string `yaml:"driver"` // 驱动
4040
Host string `yaml:"host"` // 数据库地址
41+
AllowNativePasswords bool `yaml:"allow_native_passwords"` // 是否允许nativePassword
4142

4243
// 以下配置关于连接池
4344
ConnMaxIdle int `yaml:"conn_max_idle"` // 最大空闲连接数
@@ -68,6 +69,7 @@ func (conf *DBConfig) FormatDsn() (string, error) {
6869
if err != nil {
6970
return "", err
7071
}
72+
7173
driverConf := &mysql.Config{
7274
User: conf.Username,
7375
Passwd: conf.Password,
@@ -80,6 +82,7 @@ func (conf *DBConfig) FormatDsn() (string, error) {
8082
ReadTimeout: readTimeout,
8183
WriteTimeout: writeTimeout,
8284
ParseTime: conf.ParseTime,
85+
AllowNativePasswords: conf.AllowNativePasswords,
8386
}
8487
return driverConf.FormatDSN(), nil
8588
}

0 commit comments

Comments
 (0)