Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hadihammurabi/asynks
Run asynchronous tasks in Go
https://github.com/hadihammurabi/asynks
Last synced: about 2 months ago
JSON representation
Run asynchronous tasks in Go
- Host: GitHub
- URL: https://github.com/hadihammurabi/asynks
- Owner: hadihammurabi
- Created: 2022-02-28T14:11:34.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-08T09:56:05.000Z (about 2 years ago)
- Last Synced: 2024-06-20T12:46:33.057Z (7 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# asynks
Run asynchronous tasks in Go.> Inspired by Promise methods in JS
# Features
* Run functions asynchronously
* Clear API
* Remove goroutine complexity# Example
```go
package mainimport (
"fmt"// Import asynks
"github.com/hadihammurabi/asynks"
)func main() {
// Use asynks.All to run all functions asynchronously
results, err := asynks.All(
func() (interface{}, error) {
return 1, nil
},
func() (interface{}, error) {
return 2, nil
},
func() (interface{}, error) {
return 3, nil
},
)// Panic on error and print the results
if err != nil {
panic(err)
}
fmt.Println(results)
}
```