Describe the bug
When scanning a row into an invalid type such as a string into an int an error should be returned. As of v3.40 and later the error is being ignored. It looks like it may be due to the error being ignored rather than returned here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L50
To Reproduce
import (
"context"
"github.com/pashagolub/pgxmock/v3"
"github.com/stretchr/testify/assert"
"testing"
)
func Test_QueryScanProblem(t *testing.T) {
mockSql, _ := pgxmock.NewPool()
ctx := context.Background()
mockSql.ExpectQuery(`select id from example_table limit 1`).WillReturnRows(
mockSql.NewRows([]string{"seq"}).AddRow("not-an-int"),
)
row := mockSql.QueryRow(ctx, `select id from example_table limit 1`)
var expectedInt int
err := row.Scan(&expectedInt)
assert.ErrorContains(t, err, "Destination kind 'int' not supported for value kind")
}
Describe the bug When scanning a row into an invalid type such as a string into an int an error should be returned. As of v3.40 and later the error is being ignored. It looks like it may be due to the error being ignored rather than returned here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L50
To Reproduce
Expected behavior The error triggered here: https://github.com/pashagolub/pgxmock/blob/master/rows.go#L142 should be returned instead of a nil error.