Skip to content

Commit

Permalink
fix TestAllowsToSetRowsErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub committed Feb 17, 2021
1 parent 31d1040 commit 4837708
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type rowSets struct {
}

func (rs *rowSets) Err() error {
return rs.sets[rs.pos].closeErr
r := rs.sets[rs.pos]
return r.nextErr[r.pos-1]
}

func (rs *rowSets) CommandTag() pgconn.CommandTag {
Expand Down Expand Up @@ -76,7 +77,7 @@ func (rs *rowSets) Scan(dest ...interface{}) error {
//behave compatible with pgx
continue
}
destVal := reflect.ValueOf(dest[i])
destVal := reflect.ValueOf(dest[i])
if destVal.Kind() != reflect.Ptr {
return fmt.Errorf("Destination argument must be a pointer for column %s", r.defs[i].Name)
}
Expand Down
4 changes: 2 additions & 2 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ func TestAllowsToSetRowsErrors(t *testing.T) {
t.Fatalf("unexpected error: %s", rs.Err())
}

if rs.Next() {
t.Fatal("was not expecting the second row, since there should be an error")
if !rs.Next() {
t.Fatal("expected the second row to be available, even there should be an error")
}
if rs.Err() == nil {
t.Fatal("expected an error, but got none")
Expand Down

0 comments on commit 4837708

Please sign in to comment.