Documentation
¶
Index ¶
- func Bulk(ctx context.Context, ch <-chan interface{}, count int) <-chan []interface{}
- func BulkEntities(ctx context.Context, ch <-chan contracts.Entity, count int) <-chan []contracts.Entity
- func BulkXMessages(ctx context.Context, ch <-chan redis.XMessage, count int) <-chan []redis.XMessage
- func CopyFirst(ctx context.Context, input <-chan contracts.Entity) (first contracts.Entity, forward <-chan contracts.Entity, err error)
- func ErrgroupReceive(g *errgroup.Group, err <-chan error)
- func WaitAsync(w contracts.Waiter) <-chan error
- type Bulker
- type Cond
- type Counter
- type EntityBulker
- type XMessageBulker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bulk ¶
Bulk reads all values from a channel and streams them in chunks into a returned channel.
func BulkEntities ¶
func BulkEntities(ctx context.Context, ch <-chan contracts.Entity, count int) <-chan []contracts.Entity
BulkEntities reads all entities from a channel and streams them in chunks into a returned channel.
func BulkXMessages ¶
func BulkXMessages(ctx context.Context, ch <-chan redis.XMessage, count int) <-chan []redis.XMessage
BulkXMessages reads all values from a channel and streams them in chunks into a returned channel.
func CopyFirst ¶
func CopyFirst( ctx context.Context, input <-chan contracts.Entity, ) (first contracts.Entity, forward <-chan contracts.Entity, err error)
CopyFirst asynchronously forwards all items from input to forward and synchronously returns the first item.
func ErrgroupReceive ¶
ErrgroupReceive adds a goroutine to the specified group that returns the first non-nil error (if any) from the specified channel. If the channel is closed, it will return nil.
Types ¶
type Bulker ¶
type Bulker struct {
// contains filtered or unexported fields
}
Bulker reads all values from a channel and streams them in chunks into a Bulk channel.
type Cond ¶
type Cond struct {
// contains filtered or unexported fields
}
Cond implements a channel-based synchronization for goroutines that wait for signals or send them. Internally based on a controller loop that handles the synchronization of new listeners and signal propagation, which is only started when NewCond is called. Thus the zero value cannot be used.
func (*Cond) Broadcast ¶
func (c *Cond) Broadcast()
Broadcast sends a signal to all current listeners by closing the previously returned channel from Wait. Panics if the controller loop has already ended.
func (*Cond) Close ¶
Close stops the controller loop, waits for it to finish, and returns an error if any. Implements the io.Closer interface.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter implements an atomic counter.
type EntityBulker ¶
type EntityBulker struct {
// contains filtered or unexported fields
}
EntityBulker reads all entities from a channel and streams them in chunks into a Bulk channel.
func NewEntityBulker ¶
NewEntityBulker returns a new EntityBulker and starts streaming.
func (*EntityBulker) Bulk ¶
func (b *EntityBulker) Bulk() <-chan []contracts.Entity
Bulk returns the channel on which the bulks are delivered.
type XMessageBulker ¶
type XMessageBulker struct {
// contains filtered or unexported fields
}
XMessageBulker reads all values from a channel and streams them in chunks into a Bulk channel.
func NewXMessageBulker ¶
NewXMessageBulker returns a new XMessageBulker and starts streaming.
func (*XMessageBulker) Bulk ¶
func (b *XMessageBulker) Bulk() <-chan []redis.XMessage
Bulk returns the channel on which the bulks are delivered.