This PR extends the support for batch operation mocking and assertions in the pgxmock package. It modifies the SendBatch method to allow mocking and asserting batch operations. Additionally, it adds tests to ensure the correctness of the new functionality.
Summary
Modified the SendBatch method in pgxmock.go to support mocking and asserting batch operations.
Created a new type, mockBatchResults, to represent a batch operation and implemented the pgx.BatchResults interface for this type.
Updated the SendBatch method to create a new mockBatchResults instance, execute all the queries in the batch, and return the mockBatchResults instance.
Added a new test function, TestSendBatch, in pgxmock_test.go to test the SendBatch method and ensure its correctness.
Fixes #149.
To checkout this PR branch, run the following command in your terminal:
git checkout sweep/extend-batch-mocking
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.
Description
This PR extends the support for batch operation mocking and assertions in the
pgxmock
package. It modifies theSendBatch
method to allow mocking and asserting batch operations. Additionally, it adds tests to ensure the correctness of the new functionality.Summary
SendBatch
method inpgxmock.go
to support mocking and asserting batch operations.mockBatchResults
, to represent a batch operation and implemented thepgx.BatchResults
interface for this type.SendBatch
method to create a newmockBatchResults
instance, execute all the queries in the batch, and return themockBatchResults
instance.TestSendBatch
, inpgxmock_test.go
to test theSendBatch
method and ensure its correctness.Fixes #149.
To checkout this PR branch, run the following command in your terminal:
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.