mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
1.3 KiB
1.3 KiB
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AsyncX | asyncx | concurrency.go#L35 | core | concurrency |
|
https://go.dev/play/p/uo35gosuTLw |
|
|
10 |
Runs a function asynchronously and returns results via channels. Variants support 0 to 6 return values, using tuple types for multi-value results.
Variants: Async, Async0..Async6
ch := lo.Async(func() int {
time.Sleep(10 * time.Millisecond)
return 42
})
v := <-ch
done := lo.Async0(func() {
time.Sleep(5 * time.Millisecond)
})
<-done