kamildrazkiewicz / Go Flow
Licence: mit
Simply way to control goroutines execution order based on dependencies
Stars: ✭ 158
Labels
Projects that are alternatives of or similar to Go Flow
Gsysint
Golang (as of 1.12.5) runtime internals that gives you an access to internal scheduling primitives. Park Gs, read IDs. (for learning purposes)
Stars: ✭ 44 (-72.15%)
Mutual labels: goroutine
Go Concurrency
This repos has lots of Go concurrency, goroutine and channel usage and best practice examples
Stars: ✭ 84 (-46.84%)
Mutual labels: goroutine
Ants
🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants 是一个高性能且低损耗的 goroutine 池。
Stars: ✭ 7,180 (+4444.3%)
Mutual labels: goroutine
Machine
Machine is a zero dependency library for highly concurrent Go applications. It is inspired by errgroup.Group with extra bells & whistles
Stars: ✭ 346 (+118.99%)
Mutual labels: goroutine
Routine
go routine control, abstraction of the Main and some useful Executors.如果你不会管理Goroutine的话,用它
Stars: ✭ 40 (-74.68%)
Mutual labels: goroutine
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+236.71%)
Mutual labels: goroutine
Wasps
wasps is a lightweight goroutine pool for golang, use limited goroutines to achieve multi-task concurrent execution.
Stars: ✭ 88 (-44.3%)
Mutual labels: goroutine
Golang runtime reading
golang 1.10.2 runtime code reading - golang runtime源码分析。只有思考过,你才会印象深刻。
Stars: ✭ 393 (+148.73%)
Mutual labels: goroutine
Fgbase
Ready-send coordination layer on top of goroutines.
Stars: ✭ 45 (-71.52%)
Mutual labels: goroutine
Gos
基于Go语言的分布式游戏服务器框架,通讯协议:WebSocket、TCP,消息协议:JSON、Protobuf、二进制
Stars: ✭ 147 (-6.96%)
Mutual labels: goroutine
Go Tls
A bit safer approach to implement Thread Local Storage (TLS) for Go 1.7+.
Stars: ✭ 104 (-34.18%)
Mutual labels: goroutine
Gollback
Go asynchronous simple function utilities, for managing execution of closures and callbacks
Stars: ✭ 55 (-65.19%)
Mutual labels: goroutine
Goflow
Goflow is a simply package to control goroutines execution order based on dependencies. It works similar to async.auto
from node.js async package, but for Go.
Install
Install the package with:
go get github.com/kamildrazkiewicz/go-flow
Import it with:
import "github.com/kamildrazkiewicz/go-flow"
and use goflow
as the package name inside the code.
Example
package main
import (
"fmt"
"github.com/kamildrazkiewicz/go-flow"
"time"
)
func main() {
f1 := func(r map[string]interface{}) (interface{}, error) {
fmt.Println("function1 started")
time.Sleep(time.Millisecond * 1000)
return 1, nil
}
f2 := func(r map[string]interface{}) (interface{}, error) {
time.Sleep(time.Millisecond * 1000)
fmt.Println("function2 started", r["f1"])
return "some results", nil
}
f3 := func(r map[string]interface{}) (interface{}, error) {
fmt.Println("function3 started", r["f1"])
return nil, nil
}
f4 := func(r map[string]interface{}) (interface{}, error) {
fmt.Println("function4 started", r)
return nil, nil
}
res, err := goflow.New().
Add("f1", nil, f1).
Add("f2", []string{"f1"}, f2).
Add("f3", []string{"f1"}, f3).
Add("f4", []string{"f2", "f3"}, f4).
Do()
fmt.Println(res, err)
}
Output will be:
function1 started
function3 started 1
function2 started 1
function4 started map[f2:some results f3:<nil>]
map[f1:1 f2:some results f3:<nil> f4:<nil>] <nil>
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].