mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
769 B
769 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | similarHelpers | position | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BufferWithTimeout | bufferwithtimeout | channel.go#L214 | core | channel |
|
|
|
263 |
BufferWithTimeout reads up to size items from a channel with timeout.
ch := make(chan int)
go func() {
time.Sleep(200 * time.Millisecond)
ch <- 1
}()
items, length, readTime, ok := lo.BufferWithTimeout(ch, 5, 100*time.Millisecond)
// Returns empty slice due to timeout