@Id MySQLConnectionV2 @Description connect to mysql instance. @Tags mysql @Security ApiKeyAuth @Param mysql_host query string true "mysql host" @Param mysql_port query string true "mysql port" @Param mysql_user query string true "mysql user" @Param mysql_password query string true "mysql password"
(c echo.Context)
| 102 | // @Success 200 {object} models.ConnectionRespV2 |
| 103 | // @Router /v2/mysql/instance_connection [get] |
| 104 | func MySQLConnectionV2(c echo.Context) error { |
| 105 | logger := handler.NewLogger().Named("MySQLConnectionReqV2") |
| 106 | reqParam := new(models.MySQLConnectionReqV2) |
| 107 | if err := handler.BindAndValidate(logger, c, reqParam); err != nil { |
| 108 | return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(err)) |
| 109 | } |
| 110 | newReqParam := &models.ConnectionReqV2{ |
| 111 | DatabaseType: DB_TYPE_MYSQL, |
| 112 | Host: reqParam.MysqlHost, |
| 113 | Port: int(reqParam.MysqlPort), |
| 114 | User: reqParam.MysqlUser, |
| 115 | Password: reqParam.MysqlPassword, |
| 116 | IsPasswordEncrypted: reqParam.IsMysqlPasswordEncrypted, |
| 117 | } |
| 118 | err := connectDatabase(newReqParam) |
| 119 | if err != nil { |
| 120 | return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(err)) |
| 121 | } |
| 122 | return c.JSON(http.StatusOK, &models.ConnectionRespV2{ |
| 123 | BaseResp: models.BuildBaseResp(nil), |
| 124 | }) |
| 125 | } |
nothing calls this directly
no test coverage detected