Promises in Go and CQRS Framework for Node.js
Summary of my bookmarked Github repositories from Mar 17th, 2022
go-promise is a Go library that provides promises and futures, inspired by the concepts of Futures and promises. It offers features such as creating promises and futures, setting callbacks for success, failure, and completion, getting the result of a future, setting timeouts, merging multiple promises, pipelining promises, canceling futures, and more. It provides a convenient API for handling asynchronous operations in Go. The library is available on GitHub and is licensed under the MIT License.
The provided code demonstrates the usage of promises in Go (Golang). It includes two promises, `p1` and `p2`, which perform different asynchronous operations. `p1` calculates the factorial of 20 using recursion, while `p2` fetches the public IP address by making an HTTP request to "https://httpbin.org/ip". The code then awaits the resolution of both promises using the `Await` method and prints the resulting factorial and IP address. This example showcases how promises can be used for concurrent and non-blocking operations in Go.