MCPcopy Index your code
hub / github.com/apache/answer / CheckDatabase

Function CheckDatabase

internal/install/install_controller.go:131–148  ·  view source on GitHub ↗

CheckDatabase check database if exist when installation @Summary check database if exist when installation @Description check database if exist when installation @Tags installation @Accept json @Produce json @Param data body install.CheckDatabaseReq true "CheckDatabaseReq" @Success 200 {object} han

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

129// @Success 200 {object} handler.RespBody{data=install.CheckConfigFileResp{}}
130// @Router /installation/db/check [post]
131func CheckDatabase(ctx *gin.Context) {
132 req := &CheckDatabaseReq{}
133 if handler.BindAndCheck(ctx, req) {
134 return
135 }
136
137 resp := &CheckDatabaseResp{}
138 dataConf := &data.Database{
139 Driver: req.DbType,
140 Connection: req.GetConnection(),
141 }
142 resp.ConnectionSuccess = cli.CheckDBConnection(dataConf)
143 if !resp.ConnectionSuccess {
144 handler.HandleResponse(ctx, errors.BadRequest(reason.DatabaseConnectionFailed), schema.ErrTypeAlert)
145 return
146 }
147 handler.HandleResponse(ctx, nil, resp)
148}
149
150// InitEnvironment init environment
151// @Summary init environment

Callers

nothing calls this directly

Calls 4

GetConnectionMethod · 0.95
BindAndCheckFunction · 0.92
CheckDBConnectionFunction · 0.92
HandleResponseFunction · 0.92

Tested by

no test coverage detected