go-sqlmock
go-sqlmock copied to clipboard
Sql mock driver for golang to test database interactions
fix #298 using https://github.com/DATA-DOG/go-sqlmock/pull/142 in main branch
I didn't see need to enable/disable this, so kept it as default behaviour.
This PR addresses an issue where the user wants to embed the `SqlMock` creation code into a function, like so: ``` func createServiceMock(database string, schema string, opts ...sqlmock.SqlMockOption) (*MyDB, sqlmock.Sqlmock)...
### Question I'm always confused about preload, can you add more usage examples, one-to-one and one-to-many examples
### Proposal Under the existing design, user has to manually modify their csv string to match with csv reader defaults. `func (r *Rows) FromCSVString(s string) *Rows` function initialize a csv...
### Operating system and Go Version macOS 14.4.1, Go 1.20 ### Issue When using `db.Query` to perform a query that does not return any rows, sqlmock panics instead of performing...
this PR address the lack of support for output parameters adding: - **sqlmock.NamedOutputArg** and **sqlmock.NamedInputOutputArg** functions that support mapping values for sql.Named output and input/output parameters - **sqlmock.TypedOutputArg** function that...
I implement code with dependency injection Like this: article.go ```go type IArticleRepo interface { List() ([]*entity.Article, error) Detail(id uint) (*entity.Article, error) Create(item *entity.Article) error Update(id uint, items map[string]interface{}) error Delete(ids...
closes #316 ``` func TestContextBeginWithTxOptions(t *testing.T) { t.Parallel() db, mock, err := New() if err != nil { t.Errorf("an error '%s' was not expected when opening a stub database connection",...
# Sql Mismatch Here is my output error ```go ExecQuery: could not match actual sql: "INSERT INTO `arg_configs` (`created_at`,`updated_at`,`arg_name`,`arg_key`,`arg_value`,`arg_comment`) VALUES (?,?,?,?,?,?)" with expected regexp "INSERT INTO `arg_configs` (`created_at`,`updated_at`,`arg_name`,`arg_key`,`arg_value`,`arg_comment`)"; call to...