Skip to content

yandd/fsm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FSM - Finite state machine in Go

usage

go get github.com/yandd/fsm

example

fsm

f, err := fsm.NewFSM("inited", []interface{}{"ended"}, fsm.FSMEvents{
	{Name: "start", From: "inited", To: "started"},
	{Name: "work", From: "started", To: "working"},
	{Name: "end", From: []interface{}{"started", "working"}, To: "ended"},
})

support export .dot file

f.Dot("diag_name")
digraph diag_name {
	rankdir=LR;
	node [shape = doublecircle];ended ;
	node [shape = circle];

	inited -> started [ label = "start" ];
	started -> working [ label = "work" ];
	started -> ended [ label = "end" ];
	working -> ended [ label = "end" ];
}

About

FSM - Finite state machine in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages