ListBenchmarks lists all benchmarks
(c *gin.Context)
| 448 | |
| 449 | // ListBenchmarks lists all benchmarks |
| 450 | func (h *EvalHandler) ListBenchmarks(c *gin.Context) { |
| 451 | ctx := c.Request.Context() |
| 452 | |
| 453 | records, err := (*h.store).List(ctx, "benchmarks") |
| 454 | if err != nil { |
| 455 | c.JSON(http.StatusInternalServerError, gin.H{ |
| 456 | "success": false, |
| 457 | "error": gin.H{ |
| 458 | "code": "internal_error", |
| 459 | "message": err.Error(), |
| 460 | }, |
| 461 | }) |
| 462 | return |
| 463 | } |
| 464 | |
| 465 | benchmarks := make([]*BenchmarkRecord, 0) |
| 466 | for _, record := range records { |
| 467 | var benchmark BenchmarkRecord |
| 468 | if err := store.DecodeValue(record, &benchmark); err != nil { |
| 469 | continue |
| 470 | } |
| 471 | benchmarks = append(benchmarks, &benchmark) |
| 472 | } |
| 473 | |
| 474 | c.JSON(http.StatusOK, gin.H{ |
| 475 | "success": true, |
| 476 | "data": benchmarks, |
| 477 | }) |
| 478 | } |
| 479 | |
| 480 | // GetBenchmark retrieves a single benchmark |
| 481 | func (h *EvalHandler) GetBenchmark(c *gin.Context) { |
nothing calls this directly
no test coverage detected