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 have similar issues with transaction. I'm using sqlite for unit tests and have SetMaxOpenConns(1). When I try to use gen.Transaction it locks, but gorm.DB.Transaction works.
GORM Playground Link
It's really hard to simulate by gen.go in gorm playground repo, but this issue is indeed critical. Thanks to @peterxcli for discovering this bug.
Description
First, we define
User
andRole
in model package. A user has many roles, and a role can assign to multiple users, so they aremany2many
relation.And then, we generate the query for these two structs
Next, in our main function, we insert the default rules
However, if i try to use a transaction to append roles to a single user, the transaction will lock until timeout
The text was updated successfully, but these errors were encountered: