Skip to content

resonatehq/gocoro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gocoro

A coroutine library for go that supports async await semantics.

Usage

return func(c *gocoro.Coroutine[func() (string, error), string, string]) (string, error) {

  // yield a function
  p := gocoro.Yield(c, func() (string, error) {
    return "foo", nil
  })

  // yield a coroutine
  c := gocoro.Spawn(c, func(c *gocoro.Coroutine[func() (string, error), string, string]) (string, error) {
    return "bar", nil
  })

  // await function
  foo, _ := gocoro.Await(c, p)

  // await coroutine
  bar, _ := gocoro.Await(c, c)

  return foo + bar, nil
}

See the example for complete usage details.

About

A coroutine library for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages