revert

package
v0.0.0-...-c34bea4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinalizeFunc

type FinalizeFunc func()

FinalizeFunc is a function returned by a successful function call, which finalizes the initial function call. A call that returns an error should return a nil FinalizeFunc. When a call returns both a RevertFunc and a FinalizeFunc, at most one may be called. The side effects of the FinalizeFunc are not reverted by the RevertFunc.

type FinalizeList

type FinalizeList struct {
	// contains filtered or unexported fields
}

FinalizeList is a list of FinalizeFuncs to be executed in the same order they were appended.

func (*FinalizeList) Append

func (f *FinalizeList) Append(finalizeFunc FinalizeFunc)

Append appends the given FinalizeFunc at the end of this list. If the function is nil, it is ignored.

func (*FinalizeList) Finalize

func (f *FinalizeList) Finalize()

Finalize executes all the FinalizeFuncs in the given list in the same order they were pushed.

type RevertFunc

type RevertFunc func() error

RevertFunc is a function returned by a successful function call, which reverts the side-effects of the initial function call. A call that returns an error should return a nil RevertFunc.

type RevertStack

type RevertStack struct {
	// contains filtered or unexported fields
}

RevertStack is a stack of RevertFuncs to be executed in the reverse order they were pushed.

func (*RevertStack) Extend

func (s *RevertStack) Extend(t RevertStack)

Extend extends the revert stack by the given stack.

func (*RevertStack) Push

func (s *RevertStack) Push(revertFunc RevertFunc)

Push pushes the given RevertFunc on top of this stack. If the function is nil, it is ignored.

func (*RevertStack) Revert

func (s *RevertStack) Revert() error

Revert executes all the RevertFuncs in the given stack in the reverse order they were pushed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL