You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's talk about a new suite of helpers for manipulating channels.
// ToChannel returns a read-only channels of collection elements.funcToChannel[Tany](collection []T) <-chanT
// Generator implements the generator design pattern.funcGenerator[Tany](bufferSizeint, generatorfunc(int64) T) <-chanT
// Batch creates a slice of n elements from a channel. Returns the slice and the slice length.funcBatch[Tany](ch<-chanT, sizeint) (collection []T, lengthint)
// BatchWithTimeout creates a slice of n elements from a channel, with timeout. Returns the slice and the slice length.funcBatchWithTimeout[Tany](ch<-chanT, sizeint, timeout time.Duration) (collection []T, lengthint)
Some thoughts about BatchXXX functions:
return channel status: ok bool?
return batch time: duration time.Duration?
return <-chan []T instead of []T ?
accept a buffer as a parameter instead of repeated allocation?
allocate channel with buffer size > 1 ?
The text was updated successfully, but these errors were encountered:
Let's talk about a new suite of helpers for manipulating channels.
Some thoughts about BatchXXX functions:
ok bool
?duration time.Duration
?<-chan []T
instead of[]T
?The text was updated successfully, but these errors were encountered: