package
0.0.0-20200601021147-e1aa8c7e24af
Repository: https://github.com/hello2mao/go-common.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# Functions

NewFSM constructs a FSM from events and callbacks.
Visualize outputs a visualization of a FSM in Graphviz format.
VisualizeWithType outputs a visualization of a FSM in the desired format.

# Constants

GRAPHVIZ the type for graphviz output (http://www.webgraphviz.com/).
MERMAID the type for mermaid output (https://mermaid-js.github.io/mermaid-live-editor/).

# Structs

AsyncError is returned by FSM.Event() when a callback have initiated an asynchronous state transition.
CanceledError is returned by FSM.Event() when a callback have canceled a transition.
Event is the info that get passed as a reference in the callbacks.
EventDesc represents an event when initializing the FSM.
FSM is the state machine that holds the current state.
InternalError is returned by FSM.Event() and should never occur.
InTransitionError is returned by FSM.Event() when an asynchronous transition is already in progress.
InvalidEventError is returned by FSM.Event() when the event cannot be called in the current state.
NotInTransitionError is returned by FSM.Transition() when an asynchronous transition is not in progress.
NoTransitionError is returned by FSM.Event() when no transition have happened, for example if the source and destination states are the same.
UnknownEventError is returned by FSM.Event() when the event is not defined.

# Type aliases

Callback is a function type that callbacks should use.
Callbacks is a shorthand for defining the callbacks in NewFSM.a.
Events is a shorthand for defining the transition map in NewFSM.
VisualizeType the type of the visualization.