Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToCamelCase ¶
ToCamelCase transform string to upper or lower camel case
func ToSnackCase ¶
Types ¶
type Generator ¶
type Generator struct { Options // contains filtered or unexported fields }
Generator generates finite state machine
func NewGenerator ¶
NewGenerator returns a pointer to Generator
type Options ¶
type Options struct { // InputPackage is an import path or a relative path of the package that contains the source struct InputPackage string // OutputFile name for output file OutputFile string // Struct is name of struct Struct string // StateField is name of struct field that indicate state StateField string // TransitionsFile is path to file which hold supported transitions TransitionsFile string // DisableGoGenerate don't put go generate DisableGoGenerate bool // ActionGraphOutputFile path to action graph file ActionGraphOutputFile string }
Options for NewGenerator constructor
type StateValue ¶
StateValue represents state field values
type Struct ¶
type Struct struct { Name string StateField string StateType string StateValues []StateValue Transitions Transitions }
Struct represent struct data
type Transition ¶
type Transition struct { From stringArray `json:"from" yaml:"from"` To string `json:"to" yaml:"to"` Event string `json:"event" yaml:"event"` BeforeActions []string `json:"before_actions" yaml:"before_actions"` Actions []string `json:"actions" yaml:"actions"` }
Transition represent fsm state transition
func (Transition) String ¶
func (t Transition) String() string
type Transitions ¶
type Transitions []Transition
Transitions slice of Transition
func (Transitions) ActionTransitions ¶
func (trs Transitions) ActionTransitions(action string) []Transition
func (Transitions) Actions ¶
func (trs Transitions) Actions() []string
Actions return unique slice of actions
func (Transitions) Events ¶
func (trs Transitions) Events() []string
func (Transitions) Graph ¶
func (trs Transitions) Graph() *graphman.Graph
Click to show internal directories.
Click to hide internal directories.