Skip to content

Commit

Permalink
fix(tests): always close Row
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi committed Apr 9, 2024
1 parent dd1f9ee commit 102bb55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions row.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ func (r *Row) Close() error {
}

func (r *Row) Scan(dest ...any) error {
defer r.Close()

if r.err != nil {
return r.err
}

defer r.Close()
for _, dp := range dest {
if _, ok := dp.(*sql.RawBytes); ok {
return errors.New("sql: RawBytes isn't allowed on Row.Scan")
Expand All @@ -62,11 +63,12 @@ func (r *Row) Err() error {
}

func (r *Row) Bind(dest any) error {
defer r.Close()

if r.err != nil {
return r.err
}

defer r.Close()
if !r.rows.Next() {
if err := r.rows.Err(); err != nil {
return err
Expand Down

0 comments on commit 102bb55

Please sign in to comment.