Categorygithub.com/andviro/go-state
modulepackage
3.0.2+incompatible
Repository: https://github.com/andviro/go-state.git
Documentation: pkg.go.dev

# README

Go-state

Build Status Coverage Go Report Card GoDoc

A simple helper library for programming robust state-oriented applications

Credits

It borrows the idea from internal state machine of Golang template package. To learn more, see the package sources and a blog entry.

Usage

See example_state_test.go to get an idea.

License

This code is released under MIT license.

# Functions

Chain is a series of state modifiers that apply sequentially to the initial state Func.
Name returns name of current state extracted from context.
Run starts the state machine with the provided context and initial Func.

# Type aliases

Func is a basic building block of state machine.
Hook is a function that's run when machine is about to enter certain state.
Middleware is a simple modifier for state function.