Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels