Some new REST endpoints; cleanup

This commit is contained in:
Lou Knauer
2022-03-03 14:54:37 +01:00
parent 5f12b49145
commit 046d4d5187
5 changed files with 122 additions and 31 deletions

View File

@@ -60,6 +60,7 @@ func (r *JobRepository) QueryJobs(
for rows.Next() {
job, err := scanJob(rows)
if err != nil {
rows.Close()
return nil, err
}
jobs = append(jobs, job)

View File

@@ -1,8 +1,6 @@
package repository
import (
"fmt"
"github.com/ClusterCockpit/cc-backend/metricdata"
"github.com/ClusterCockpit/cc-backend/schema"
sq "github.com/Masterminds/squirrel"
@@ -88,9 +86,8 @@ func (r *JobRepository) CountTags(user *string) (tags []schema.Tag, counts map[s
for rows.Next() {
var tagName string
var count int
err = rows.Scan(&tagName, &count)
if err != nil {
fmt.Println(err)
if err := rows.Scan(&tagName, &count); err != nil {
return nil, nil, err
}
counts[tagName] = count
}