Here is my query
select col1, col2, col3 from tableX where col1 = ? and col2 = ? and col3 = ?
I set the mocks like this
mock.ExpectQuery(regexp.QuoteMeta(myQuery)).WithArgs(col1Val, col2Val, col3Val).WillReturn(row1)
Then i set up another expect query like this
mock.ExpectQuery(regexp.QuoteMeta(myQuery)).WithArgs(x,y,z).WillReturn(row2)
But it didn't return the row2. Rather i got "No Rows". Am i missing something here? (I am new to Go)
Forgot to mention that this query is being called in a for loop. For first iteration of for loop, the values are col1Val
, col2Val
, col3Val
and for second iteration the value is x
, y
and z
.
Aucun commentaire:
Enregistrer un commentaire