Skip to main content

SingleItemBatches

Creates n batches of items, where each batch contains a single item.

def SingleItemBatches(
context: context.Context,
snapshot: []ItemWrapper
) - > []Batch

Creates n batches of items, where n is the number of items in the input snapshot, and each batch contains exactly one item. This is useful for processing each item individually within a batch-oriented system.

Parameters

NameTypeDescription
contextcontext.ContextThe context for the operation, typically used for cancellation or deadlines.
snapshot[]ItemWrapperA slice of ItemWrapper objects to be divided into single-item batches.

Returns

TypeDescription
[]BatchA slice of batches, where each batch contains a single ItemWrapper.