go-sqlmock
go-sqlmock copied to clipboard
How mock sql many times?
trafficstars
-
Hello, when I exec one sql many times, I got the error: --- FAIL: TestMysqlProxy_getItemByID (0.00s) --- FAIL: TestMysqlProxy_getItemByID/getItemByID_OK (0.00s) main_test.go:49: err: all expectations were already fulfilled, call to Query 'SELECT id, name FROM user where id = ?' with args [{Name: Ordinal:1 Value:1}] was not expected, got: {ID:0 Name:} main_test.go:51: MysqlProxy.getItemByID() error = all expectations were already fulfilled, call to Query 'SELECT id, name FROM user where id = ?' with args [{Name: Ordinal:1 Value:1}] was not expected, wantErr false
-
my code

-
unit test code

maybe #257 can help you