go-sqlmock
go-sqlmock copied to clipboard
Sql mock driver for golang to test database interactions
Hi, I have an issue with mocking for GORM that uses timestamp on the model. For example, I have this model ```go type SomeModel struct { CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`...
``` call to Query 'INSERT INTO "topic" ("name","tags","create_by","score","agree","disagree","create_time","update_time") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING "id"' with args [{Name: Ordinal:1 Value:t1} {Name: Ordinal:2 Value:} {Name: Ordinal:3 Value:} {Name: Ordinal:4 Value:0} {Name: Ordinal:5 Value:0} {Name:...
Hello. Now, only used vet and fmt as linters. It's not a problem but we can use more linters by [golangci-lint](https://github.com/golangci/golangci-lint). It might be better to introduce more linters as...
It is possible to filter a row within the mocked rows? When i try to perform a query the result is always empty. ```go type RepositoryTestSuit struct { suite.Suite repository...
Like this: ```go func (userDao *UserDao) UpdateByTx(tx *sql.Tx, user *User) (id int32, err error) { tx.Exec(....) } ``` How to simulate tx.Exec(), I tried many times but failed
This is the Error I'm getting **`all expectations were already fulfilled, call to database transaction Begin was not expected`** I have a code in my go lang ``` var userRoles...
Here is my test function. I updated the mocked data, but it's returning the not updated version. `func TestSample(t *testing.T){ db, mock, err := sqlmock.New() if err != nil {...
Hello! First of all, I'd like to say that I'm really enjoying the library and it's really making my life easier when it comes to database testing. Thanks for that!...
go version go1.14.2 darwin/amd64 github.com/DATA-DOG/go-sqlmock v1.4.1 I'm trying to mock out a piece of code which uses two prepared statements to execute a series of queries. However, sqlmock seems to...