import "github.com/magicdawn/go-co"
Package co : async/await for glolang
Await : await a Task & return it's result
e.g res := co.Await(Task)
type Task struct { // communicate via Channel Channel chan interface{} // store the result of the Task Result interface{} // store error Error error }
Async : create a new *Task execute fn , save the result, send to channel
e.g co.Async(func() interface{}{
return val // val will be Task's Result
})
Path | Synopsis |
---|---|
coutil |
Package co imports 1 packages (graph) and is imported by 1 packages. Updated 2020-05-28. Refresh now. Tools for package owners.