async
Package async provides Promise-like concurrency helpers with context cancellation.
import "github.com/sahilkhaire/gox/async"
Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.
Functions
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| After | setTimeout(fn, d) | func | After sends the time on the returned channel when duration elapses. |
| All | Promise.all([a(), b()]) | func | All runs tasks concurrently and returns when all complete or ctx is cancelled. |
| Race | Promise.race([a(), b()]) | func | Race runs tasks concurrently and returns the first successful result or error. |
| Retry | — | func | Retry calls fn until it succeeds or attempts are exhausted. |
| Sleep | await sleep(ms) | func | Sleep waits until duration elapses or ctx is cancelled. |
| Timeout | — | func | Timeout runs fn with a deadline derived from ctx and timeout. |
Types
| Symbol | Node.js | Kind | Summary |
|---|---|---|---|
| RetryConfig | — | type | RetryConfig configures Retry backoff. |