Event is the info that get passed as a reference in the callbacks.
| 16 | |
| 17 | // Event is the info that get passed as a reference in the callbacks. |
| 18 | type Event struct { |
| 19 | // FSM is an reference to the current FSM. |
| 20 | FSM *FSM |
| 21 | |
| 22 | // Event is the event name. |
| 23 | Event string |
| 24 | |
| 25 | // Src is the state before the transition. |
| 26 | Src string |
| 27 | |
| 28 | // Dst is the state after the transition. |
| 29 | Dst string |
| 30 | |
| 31 | // Err is an optional error that can be returned from a callback. |
| 32 | Err error |
| 33 | |
| 34 | // Args is an optional list of arguments passed to the callback. |
| 35 | Args []interface{} |
| 36 | |
| 37 | // canceled is an internal flag set if the transition is canceled. |
| 38 | canceled bool |
| 39 | |
| 40 | // async is an internal flag set if the transition should be asynchronous |
| 41 | async bool |
| 42 | |
| 43 | // cancelFunc is called in case the event is canceled. |
| 44 | cancelFunc func() |
| 45 | } |
| 46 | |
| 47 | // Cancel can be called in before_<EVENT> or leave_<STATE> to cancel the |
| 48 | // current transition before it happens. It takes an optional error, which will |
nothing calls this directly
no outgoing calls
no test coverage detected