go-sqlmock
go-sqlmock copied to clipboard
Sql mock driver for golang to test database interactions
There is a bug on this line https://github.com/DATA-DOG/go-sqlmock/blob/master/sqlmock.go#L256 ``` if expected.txOpts != nil && expected.txOpts.Isolation != opts.Isolation && expected.txOpts.ReadOnly != opts.ReadOnly { return nil, fmt.Errorf("expected transaction options do not match:...
I have a test with: ```go mock.ExpectExec(`UPDATE public.project_member SET ("order", updated_at) = ($1, $2) WHERE ((project_member.project_id = $3::varchar(20)) AND (project_member.user_id = $4::varchar(20)));`). ``` and it's failing as the actual query...
### Question This is the actual code: err = c.database.QueryRowContext(ctx, "SELECT COUNT(*) FROM user_credentials WHERE user_id = $1", passwordUpdateRequest.UserId).Scan(&count) This is mock: suite.dbMock.ExpectQuery(`SELECT COUNT(*) FROM user_credentials WHERE user_id = ?`)....
### Operating system and Go Version MacOS 15.2 Apple M3,go 1.20 ### Issue use WillReturnResult(sqlmock.NewErrorResult(errors.New("mock db execute err"))) mock result err,but seem not available. mock code like this: ... mock.ExpectBegin()...
Hi, I am using the datadog sql mock example suite testing testify example and when the db.close() function is called it returns "Failed to close mock DB" ### Operating system...