-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Improved recover and automatic rollback in the panic
Lines 77 to 95 in 7bf8f7c
| func (t *Twowaysql) Transaction(ctx context.Context, fn func(tx TwowaysqlTx) error) error { | |
| tx, err := t.Begin(ctx) | |
| if err != nil { | |
| return err | |
| } | |
| if err := fn(*tx); err != nil { | |
| if rerr := tx.Rollback(); rerr != nil { | |
| return fmt.Errorf("failed rollback %v: %w", rerr, err) | |
| } | |
| return err | |
| } | |
| if err := tx.Commit(); err != nil { | |
| return err | |
| } | |
| return nil | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working