You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reading up the now closed issue for a reference on how to use github.com/DATA-DOG/go-sqlmock with gorm.
The example provided works, however if you are using the ID field with uint as per the docs then you will face the issue: call to Rollback transaction, was not expected, next expectation is: ExpectedExec => expecting Exec or ExecContext which.
The workaround is to set the ID as string as per the example in the referred issue above, (you can either set or not the the ID, the effect is the same). That will persist the data but with the caveat that you wont get the ID back since the ORM will not return the ID.
I am currently not sure how to deal with this error and it seems like this is an issue that dates back to 2020.
I've added the failing and working test via the playground link as requested.
I would appreciate a swiftly follow up here.
Thank you.
The text was updated successfully, but these errors were encountered:
GORM Playground Link
go-gorm/playground#738
Description
I was reading up the now closed issue for a reference on how to use github.com/DATA-DOG/go-sqlmock with gorm.
The example provided works, however if you are using the ID field with uint as per the docs then you will face the issue:
call to Rollback transaction, was not expected, next expectation is: ExpectedExec => expecting Exec or ExecContext which
.The workaround is to set the ID as string as per the example in the referred issue above, (you can either set or not the the ID, the effect is the same). That will persist the data but with the caveat that you wont get the ID back since the ORM will not return the ID.
I am currently not sure how to deal with this error and it seems like this is an issue that dates back to 2020.
I've added the failing and working test via the playground link as requested.
I would appreciate a swiftly follow up here.
Thank you.
The text was updated successfully, but these errors were encountered: