| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repository demonstrates the application of the Command design pattern in Go. The project highlights how to encapsulate requests as objects, enabling parameterization, queuing, and undo functionality, showcasing flexibility and best practices in design patterns and unit testing.
The Command pattern encapsulates a request as an object, thereby allowing you to parameterize clients with different requests, queue or log requests, and support undoable operations.
Ensure you have Go installed on your system. You can download it from Go's official site.
Clone this repository to your local machine:
git clone git@github.com:arthurfp/Go_Command_Pattern.git
cd Go_Command_PatternTo run the application, execute:
go run cmd/main.goTo execute the tests and verify the functionality:
go test ./pkg/commandWhen you run the application, you should see the following output:
Executing CommandOne:
Receiver: Executing ActionOne
Executing CommandTwo:
Receiver: Executing ActionTwo
Executing all commands via Invoker:
Receiver: Executing ActionOne
Receiver: Executing ActionTwoContributions are welcome! Please feel free to submit pull requests or open issues to discuss proposed changes or enhancements.
Arthur Ferreira - github.com/arthurfp
| Back | FazBrowse Home | New Git URL |