Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidState = errors.New("does not exists") StateEnd = "end" )
Functions ¶
This section is empty.
Types ¶
type FSM ¶
type FSM struct {
// contains filtered or unexported fields
}
FSM is a finite state machine
func New ¶
New creates a new finite state machine having the specified initial state with specified options
type HookAfterFunc ¶
HookAfterFunc func signature
type HookBeforeFunc ¶
HookBeforeFunc func signature
type Option ¶
type Option func(*Options)
Option func signature
func InitialState ¶
InitialState sets init state for state machine
type Options ¶
type Options struct { // DryRun mode DryRun bool // Initial state Initial string // HooksBefore func slice runs in order before state HooksBefore []HookBeforeFunc // HooksAfter func slice runs in order after state HooksAfter []HookAfterFunc }
Options struct holding fsm options
type StateFunc ¶
type StateFunc func(ctx context.Context, args interface{}, opts ...StateOption) (string, interface{}, error)
StateFunc called on state transition and return next step and error
type StateOption ¶
type StateOption func(*StateOptions)
StateOption func signature
func StateDryRun ¶
func StateDryRun(b bool) StateOption
StateDryRun says that state executes in dry run mode
Click to show internal directories.
Click to hide internal directories.