Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
Do runs a func with a new Undoer. If the func returns error, all the undo funcs, registered with the Undoer will run in reverse order and all errors will be joined with the main error.
Example ¶
fmt.Println(Do(func(u Undoer) error { u.Undo(func() error { fmt.Println("undoing") return errors.New("undo error") }) fmt.Println("doing") return errors.New("do error") }))
Output: doing undoing do error undo error
Types ¶
Click to show internal directories.
Click to hide internal directories.