MCPcopy Create free account
hub / github.com/actiontech/dtle / buildMysqlUri

Function buildMysqlUri

api/handler/v2/database.go:256–278  ·  view source on GitHub ↗
(host, user, pwd, characterSet string, port int, isMysqlPasswordEncrypted bool)

Source from the content-addressed store, hash-verified

254}
255
256func 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.

Callers 3

listMySQLSchemaFunction · 0.85
listMySQLColumnsFunction · 0.85
connectDatabaseFunction · 0.85

Calls 2

GetDBUriMethod · 0.95
DecryptPasswordFunction · 0.92

Tested by

no test coverage detected