(host, user, pwd, characterSet string, port int, isMysqlPasswordEncrypted bool)
| 254 | } |
| 255 | |
| 256 | func buildMysqlUri(host, user, pwd, characterSet string, port int, isMysqlPasswordEncrypted bool) (string, error) { |
| 257 | mysqlConnectionConfig := mysqlconfig.ConnectionConfig{ |
| 258 | Host: host, |
| 259 | Port: port, |
| 260 | User: user, |
| 261 | Password: pwd, |
| 262 | Charset: characterSet, |
| 263 | } |
| 264 | |
| 265 | if "" == mysqlConnectionConfig.Charset { |
| 266 | mysqlConnectionConfig.Charset = "utf8" |
| 267 | } |
| 268 | if "" != mysqlConnectionConfig.Password && isMysqlPasswordEncrypted { |
| 269 | realPwd, err := handler.DecryptPassword(mysqlConnectionConfig.Password, g.RsaPrivateKey) |
| 270 | if nil != err { |
| 271 | return "", fmt.Errorf("DecryptPassword failed: %v", err) |
| 272 | } |
| 273 | mysqlConnectionConfig.Password = realPwd |
| 274 | } |
| 275 | |
| 276 | uri := mysqlConnectionConfig.GetDBUri() |
| 277 | return uri, nil |
| 278 | } |
| 279 | |
| 280 | // @Id ConnectionV2 |
| 281 | // @Description connect to database instance. |
no test coverage detected