Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenferrer/phonestates
A demo of using stateless, an implementation of state machine in Go which uses an external storage
https://github.com/stevenferrer/phonestates
fsm state-machine stateless
Last synced: 23 days ago
JSON representation
A demo of using stateless, an implementation of state machine in Go which uses an external storage
- Host: GitHub
- URL: https://github.com/stevenferrer/phonestates
- Owner: stevenferrer
- License: mit
- Created: 2019-11-12T11:28:18.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-02T15:31:48.000Z (about 3 years ago)
- Last Synced: 2024-11-13T17:45:56.437Z (2 months ago)
- Topics: fsm, state-machine, stateless
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phone states
![phone states](./phonestates.png)
This project demonstrates the use of [stateless](https://github.com/qmuntal/stateless), an implementation of state machines in Go.
This is a modified version of the original [example](https://github.com/qmuntal/stateless/blob/master/example_test.go) which uses an external storage for storing the states.
```go
type LogRepository struct {
...
phoneLogs map[PhoneID][]Log
}
```This is a very simple in-memory store. But in reality, this external storage can be a real database (e.g. Postgres, MariaDB, etc.)
## Running
To run the example just run the command below:
` $ go build -v -o phonestates && ./phonestates `