MCPcopy Create free account
hub / github.com/bytebase/bytebase / convertToPlanCheckRunResult

Function convertToPlanCheckRunResult

backend/api/v1/plan_service.go:1258–1286  ·  view source on GitHub ↗
(result *storepb.PlanCheckRunResult_Result)

Source from the content-addressed store, hash-verified

1256}
1257
1258func convertToPlanCheckRunResult(result *storepb.PlanCheckRunResult_Result) *v1pb.PlanCheckRun_Result {
1259 resultV1 := &v1pb.PlanCheckRun_Result{
1260 Status: convertToPlanCheckRunResultStatus(result.Status),
1261 Title: result.Title,
1262 Content: result.Content,
1263 Code: result.Code,
1264 Target: result.Target,
1265 Type: convertToV1ResultType(result.Type),
1266 Report: nil,
1267 }
1268 switch report := result.Report.(type) {
1269 case *storepb.PlanCheckRunResult_Result_SqlSummaryReport_:
1270 resultV1.Report = &v1pb.PlanCheckRun_Result_SqlSummaryReport_{
1271 SqlSummaryReport: &v1pb.PlanCheckRun_Result_SqlSummaryReport{
1272 StatementTypes: convertStatementTypesToV1(report.SqlSummaryReport.StatementTypes),
1273 AffectedRows: report.SqlSummaryReport.AffectedRows,
1274 },
1275 }
1276 case *storepb.PlanCheckRunResult_Result_SqlReviewReport_:
1277 resultV1.Report = &v1pb.PlanCheckRun_Result_SqlReviewReport_{
1278 SqlReviewReport: &v1pb.PlanCheckRun_Result_SqlReviewReport{
1279 StartPosition: convertToPosition(report.SqlReviewReport.StartPosition),
1280 EndPosition: convertToPosition(report.SqlReviewReport.EndPosition),
1281 },
1282 }
1283 default:
1284 }
1285 return resultV1
1286}
1287
1288func convertToV1ResultType(t storepb.PlanCheckType) v1pb.PlanCheckRun_Result_Type {
1289 switch t {

Callers 1

Calls 4

convertToV1ResultTypeFunction · 0.85
convertToPositionFunction · 0.85

Tested by

no test coverage detected