(ctx context.Context, fn func(tx *TxWrap) error)
| 57 | } |
| 58 | |
| 59 | func WithTx(ctx context.Context, fn func(tx *TxWrap) error) (rtnErr error) { |
| 60 | waveobj.ContextUpdatesBeginTx(ctx) |
| 61 | defer func() { |
| 62 | if rtnErr != nil { |
| 63 | waveobj.ContextUpdatesRollbackTx(ctx) |
| 64 | } else { |
| 65 | waveobj.ContextUpdatesCommitTx(ctx) |
| 66 | } |
| 67 | }() |
| 68 | return txwrap.WithTx(ctx, globalDB, fn) |
| 69 | } |
| 70 | |
| 71 | func WithTxRtn[RT any](ctx context.Context, fn func(tx *TxWrap) (RT, error)) (rtnVal RT, rtnErr error) { |
| 72 | waveobj.ContextUpdatesBeginTx(ctx) |
no test coverage detected