Closed huanggze closed 5 months ago
Hi @huanggze! mock.ExpectQuery
returns an expectation for a single call to either Query
or QueryRow
(see here). To mock multiple calls, call mock.ExpectQuery
for each one of them. In your case, you can define a constant or a variable with your query regexp and then reuse it in each call to mock.ExpectQuery
.
Question
Hi, how can i do code like this:
I'd like to mock multip query cases in one mock. It seems not possible, since ExpectQuery only accept WithArgs once.
thanks