go-sqlmock
go-sqlmock copied to clipboard
Sql mock driver for golang to test database interactions
When using`WillReturnCloseError` on an `ExpectedPrepare` but not using transactions,`Close()` is not returning the error given to `WillReturnCloseError` Expected behaviour: `stmt.Close() == wantErr` Actual behaviour: `stmt.Close() == nil` Here's a failing...
I am trying to test the execution of an `UPDATE` query. The output of the failed execution is: ``` there were unfulfilled expectations: there is a remaining expectation which was...
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?
I forgot to call `.WillReturnRows(...)` on my `ExpectQuery` statement, which gave me the following error message: ``` Query 'INSERT INTO "Message" (.+) VALUES ($1, $2, $3),($4, $5, $6);$' with args...
Hey, I was wondering if it would be beneficial to add `AnyTime` to the library so that I don't need to define it in my test code. I would also...
### Question It's not easy to debug sqlmock with gorm, it always complains about > call to Query 'xxx' with args xxxx was not expected; call to Rollback transaction was...
Closes #299 I nerd-sniped myself after writing up the issue and started looking into the code. Turned out to be pretty straight-forward. So here's a PR! I hope you think...
Hi! Thank you for this useful library! With regard to cancelling queries in Postgres, through context cancellation or other mechanism like `pg_cancel_backend()`, Postgres provides no guarantee that the query will...
I have a `sqlx.Query` being called on a named query with multiple parameters. You can see a [working example](https://go.dev/play/p/mcPVU4rZ_9m), but here's the abridged version: ```golang type myStruct struct { ColumnA...