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
This is only a proposal, maybe it needs some discussion.
The idea is that if we use boiler.SetDB(db) method in order to be able to use the G variants of the models, and avoid having to pass around a sql.DB instance, then there's no way to create a transaction inside a function of a struct that does not have the db instance in scope.
It might be nice to have a method in the models package func Begin() (*sql.Tx, errors) that uses the db instance passed into the SetDB method for creating a transaction and returning it, this way we can use transactions (for example when working with relationships) but still avoid having our structs have the need of the DB instance.
The text was updated successfully, but these errors were encountered:
This is only a proposal, maybe it needs some discussion.
The idea is that if we use
boiler.SetDB(db)
method in order to be able to use the G variants of the models, and avoid having to pass around asql.DB
instance, then there's no way to create a transaction inside a function of a struct that does not have the db instance in scope.It might be nice to have a method in the models package
func Begin() (*sql.Tx, errors)
that uses the db instance passed into theSetDB
method for creating a transaction and returning it, this way we can use transactions (for example when working with relationships) but still avoid having our structs have the need of the DB instance.The text was updated successfully, but these errors were encountered: