pashagolub / pgxmock

pgx mock driver for golang to test database interactions
Other
393 stars 49 forks source link

`QueryRow().Scan()` should return `pgx.ErrNoRows` for empty mocked dataset #93

Closed pashagolub closed 2 years ago

pashagolub commented 2 years ago

Right now this fails with panic: runtime error: index out of range [0] with length 0:

    mock.ExpectQuery("SELECT").WillReturnRows(NewRows([]string{"id"}))
    if err := mock.QueryRow(context.Background(), "SELECT").Scan(&id)