Closed Woody1193 closed 1 month ago
This PR addresses an issue where the user wants to embed the SqlMock creation code into a function, like so:
SqlMock
func createServiceMock(database string, schema string, opts ...sqlmock.SqlMockOption) (*MyDB, sqlmock.Sqlmock) { db, mock, err := sqlmock.New(opts...) Expect(err).ShouldNot(HaveOccurred()) svc := FromConnection(database, schema, db) return svc, mock }
With the current implementation of go-sqlmock, this cannot done because the option references a type internal to the go-sqlmock package. By adding an alias for this type, the user can now send such options without exposing the internal sqlmock type.
go-sqlmock
sqlmock
Hi @Woody1193! Thank you very much for your contribution :heart:
This PR addresses an issue where the user wants to embed the
SqlMock
creation code into a function, like so:With the current implementation of
go-sqlmock
, this cannot done because the option references a type internal to thego-sqlmock
package. By adding an alias for this type, the user can now send such options without exposing the internalsqlmock
type.