DeleteBenchmark deletes a benchmark
(c *gin.Context)
| 512 | |
| 513 | // DeleteBenchmark deletes a benchmark |
| 514 | func (h *EvalHandler) DeleteBenchmark(c *gin.Context) { |
| 515 | ctx := c.Request.Context() |
| 516 | id := c.Param("id") |
| 517 | |
| 518 | if err := (*h.store).Delete(ctx, "benchmarks", id); err != nil { |
| 519 | if errors.Is(err, store.ErrNotFound) { |
| 520 | c.JSON(http.StatusNotFound, gin.H{ |
| 521 | "success": false, |
| 522 | "error": gin.H{ |
| 523 | "code": "not_found", |
| 524 | "message": "Benchmark not found", |
| 525 | }, |
| 526 | }) |
| 527 | return |
| 528 | } |
| 529 | c.JSON(http.StatusInternalServerError, gin.H{ |
| 530 | "success": false, |
| 531 | "error": gin.H{ |
| 532 | "code": "internal_error", |
| 533 | "message": err.Error(), |
| 534 | }, |
| 535 | }) |
| 536 | return |
| 537 | } |
| 538 | |
| 539 | logging.Info(ctx, "benchmark.deleted", map[string]any{ |
| 540 | "id": id, |
| 541 | }) |
| 542 | |
| 543 | c.Status(http.StatusNoContent) |
| 544 | } |
| 545 | |
| 546 | // RunBenchmark runs a benchmark |
| 547 | func (h *EvalHandler) RunBenchmark(c *gin.Context) { |