Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
Improved code a bit following JDRs review
Browse files Browse the repository at this point in the history
  • Loading branch information
fratt-elca committed Jul 20, 2018
1 parent 176ad24 commit c7f2103
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/files/database.go
Expand Up @@ -80,19 +80,9 @@ func (c *Database) ReadFromDb(first int32, count int32) ([]File, error) {

// Count count all the rows from the database
func (c *Database) Count() (int32, error) {
var rows, err = c.db.Query(countFilesTblStmt)
if err != nil {
return 0, errors.Wrapf(err, "error while counting the files from the database.")
}
var rows = c.db.QueryRow(countFilesTblStmt)
var count int32
defer rows.Close()
for rows.Next() {
var err = rows.Scan(&count)
if err != nil {
return 0, errors.Wrapf(err, "error while counting the files from the database.")
}
}
err = rows.Err()
var err = rows.Scan(&count)
if err != nil {
return 0, errors.Wrapf(err, "error while counting the files from the database.")
}
Expand Down

0 comments on commit c7f2103

Please sign in to comment.