OnComplete registers the provided callback that will be invoked once the related transaction ends (either completes successfully or rollbacked with an error). The callback receives the transaction error (if any) as its argument. Any additional errors returned by the OnComplete callbacks will be joi
(fn func(txErr error) error)
| 83 | // Any additional errors returned by the OnComplete callbacks will be |
| 84 | // joined together with txErr when returning the final transaction result. |
| 85 | func (a *TxAppInfo) OnComplete(fn func(txErr error) error) { |
| 86 | a.mu.Lock() |
| 87 | defer a.mu.Unlock() |
| 88 | |
| 89 | a.afterFuncs = append(a.afterFuncs, fn) |
| 90 | } |
| 91 | |
| 92 | // note: can be called only once because TxAppInfo is cleared |
| 93 | func (a *TxAppInfo) runAfterFuncs(txErr error) error { |
no outgoing calls
no test coverage detected