Skip to content

Commit

Permalink
PR Feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 8, 2024
1 parent 0b01c0d commit d067637
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/sql/rows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package sql

import "database/sql"
import (
"database/sql"
"fmt"
)

func RowsToObjects(rows *sql.Rows) ([]map[string]any, error) {
defer rows.Close()
Expand Down Expand Up @@ -30,5 +33,9 @@ func RowsToObjects(rows *sql.Rows) ([]map[string]any, error) {
objects = append(objects, object)
}

if err = rows.Err(); err != nil {
return nil, fmt.Errorf("failed to iterate over rows: %w", err)
}

return objects, nil
}

0 comments on commit d067637

Please sign in to comment.