I am using GORM to batch insert multiple rows into a MySQL table and I want to test that the behaviour is the correct one using sqlmock. I haven't found anything online regarding mocking batch inserts with sqlmock.
For inserting a single row, we would have something similar to:
mock.ExpectExec("INSERT INTO product_viewers").WithArgs(2, 3).WillReturnResult(sqlmock.NewResult(1, 1))
But how should multiple rows' values be passed to ExpectExec
in order to represent a batch insert?
mock.ExpectExec("INSERT INTO product_viewers").WithArgs(???).WillReturnResult(sqlmock.NewResult(*numInsertedRows*, *numInsertedRows*))