Browse Source

Added missed rows.Close call

main
Unbewohnte 3 years ago
parent
commit
4e87c31589
  1. 4
      dbHandle/handle.go

4
dbHandle/handle.go

@ -20,6 +20,8 @@ func (db *DB) GetEverything() ([]*randomdata.RandomData, error) {
return nil, err return nil, err
} }
defer rows.Close()
var contents []*randomdata.RandomData var contents []*randomdata.RandomData
for rows.Next() { for rows.Next() {
var id uint var id uint
@ -51,6 +53,8 @@ func (db *DB) GetSpecific(id uint) (*randomdata.RandomData, error) {
return nil, err return nil, err
} }
defer row.Close()
// there should be only one row, because we looked for a specific ID, which is a primary key // there should be only one row, because we looked for a specific ID, which is a primary key
for row.Next() { for row.Next() {
var id uint var id uint

Loading…
Cancel
Save