Closed fairking closed 1 year ago
oh, sorry for miss leading example
transaction in this call Process(ctx, transaction)
refers to transaction object/table, it's not db transaction
Should I create a new context.Context for every transaction or I can use the same one for all my transactions?
you need to use context that passed inside repo.Transaction(ctx, func(ctx context.Context) error {...}
, otherwise next execution won't happen inside transaction
Hi everyone.
I am struggling with understanding the documentation about transactions: https://go-rel.github.io/transactions/
The example shows the line
Process(ctx, transaction)
. Where is thattransaction
value coming from, and why it passed withing theUpdate()
method?Also another question: Should I create a new
context.Context
for every transaction or I can use the same one for all my transactions?