Documentation ¶
Overview ¶
Example (PkgLevelTxFunctions) ¶
package main import ( "context" "github.com/adamluzsi/frameless/pkg/txs" ) func main() { ctx := context.Background() _ = func(ctx context.Context) (rerr error) { tx, _ := txs.Begin(ctx) defer txs.Finish(&rerr, tx) txs.OnRollback(tx, func() { // something to do }) return nil }(ctx) }
Output:
Index ¶
- Constants
- func Begin(ctx context.Context) (context.Context, error)
- func Commit(ctx context.Context) error
- func Finish(returnError *error, tx context.Context)
- func OnRollback[StepFn onRollbackStepFn](ctx context.Context, step StepFn) error
- func Rollback(ctx context.Context) error
- type TxRollbackError
Examples ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func OnRollback ¶
Types ¶
type TxRollbackError ¶ added in v0.90.1
func (*TxRollbackError) Error ¶ added in v0.90.1
func (err *TxRollbackError) Error() string
func (*TxRollbackError) Unwrap ¶ added in v0.90.1
func (err *TxRollbackError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.