go-sqlmock icon indicating copy to clipboard operation
go-sqlmock copied to clipboard

Unable to mock the rows.Columns() error

Open MudassarBashir opened this issue 6 years ago • 3 comments
trafficstars

Is there a way to mock the rows.Columns() error? I've tried using RowsWillBeClosed but it seems that does not immediately close the mock rows. Is it more like a defer?

MudassarBashir avatar Dec 19 '18 21:12 MudassarBashir

Hi, at the moment I do not think this is mockable, probably worth looking how it could be added. Regarding RowsWillBeClosed, it just adds an expectation that the mocked rows have to be closed during the test unit. As far as I understand rows.Columns may return error in cases when connection is lost or rows are closed before calling it. but will need to investigate this

l3pp4rd avatar Dec 21 '18 08:12 l3pp4rd

Thank you for your response. I had a use case where I wanted a call to rows.Columns() to give me an error for testing. Thanks for keeping it in mind as a possible enhancement. Feel free to close this issue as needed.

MudassarBashir avatar Dec 21 '18 12:12 MudassarBashir

will be added to #187 at some point

l3pp4rd avatar Sep 27 '19 18:09 l3pp4rd