Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloneChannels ¶
CloneChannels provides method to Clone channels
func NewCloneChannels ¶
func NewCloneChannels[T any](opts *CloneOptions) *CloneChannels[T]
NewCloneChannels returns new instance of CloneChannels
func (*CloneChannels[T]) Clone ¶
func (s *CloneChannels[T]) Clone(ctx context.Context, src chan T, sinks ...chan<- T) error
Clone takes data from source channel(src) and sends them to sinks(send only channel) without being totally unfair
When ctx is done the workers stop promptly, dropping values not yet delivered, and close the sinks. Wait returns once they have stopped.
type CloneOptions ¶
type CloneOptions struct {
MaxDrain int // Max buffers to drain at once(default 3)
Threshold int // Threshold(default 5) is buffer length at which drains are activated
}
CloneOptions provides options for Cloning channels
type JoinChannels ¶
JoinChannels provides method to Join channels data obtained from multiple channels is sent to one channel this is useful when you have multiple sources and you want to send data to one channel
func (*JoinChannels[T]) Join ¶
func (j *JoinChannels[T]) Join(ctx context.Context, sink chan T, sources ...<-chan T) error
JoinChannels Joins Many Channels to Create One
When ctx is done the workers stop promptly, dropping values not yet delivered, and close the sink. Wait returns once they have stopped.