// BatchGetIterator retrieves all items from the batch get input
BatchGetIterator retrieves all items from the batch get input
// BatchGetIterator retrieves all items from the batch get input
func (c *Client) BatchGetIterator(ctx context.Context, input *dynamodb.BatchGetItemInput, fn func(output *dynamodb.GetItemOutput) error) error {
	var pageError error
	err := c.DynamoDB.BatchGetItemPagesWithContext(ctx, input, func(output *dynamodb.BatchGetItemOutput, b bool) bool {
		var capacity *dynamodb.ConsumedCapacity = nil
		if len(output.ConsumedCapacity) > 0 {
			capacity = output.ConsumedCapacity[0]
		}
		for _, results := range output.Responses {
			for _, raw := range results {
				pageError = fn(&dynamodb.GetItemOutput{
					Item:             raw,
					ConsumedCapacity: capacity,
				})
				if pageError != nil {
					return false
				}
			}
		}
		for tbl, unprocessed := range output.UnprocessedKeys {
			pageError = c.BatchGetIterator(ctx, c.ToBatchGetItemInput(tbl, unprocessed.Keys), fn)
			if pageError != nil {
				return false
			}
		}
		return true
	})
	if err != nil {
		return err
	}
	if pageError != nil {
		return pageError
	}
	return nil
}
func ( c * Client ) BatchGetIterator ( ctx context . Context , input * dynamodb . BatchGetItemInput , fn func ( output * dynamodb . GetItemOutput ) error ) error { var pageError error err := c . DynamoDB . BatchGetItemPagesWithContext ( ctx , input , func ( output * dynamodb . BatchGetItemOutput , b bool ) bool { var capacity * dynamodb . ConsumedCapacity = nil if len ( output . ConsumedCapacity ) > 0 { capacity = output . ConsumedCapacity [ 0 ] } for _ , results := range output . Responses { for _ , raw := range results { pageError = fn ( & dynamodb . GetItemOutput { Item : raw , ConsumedCapacity : capacity , } ) if pageError != nil { return false } } } for tbl , unprocessed := range output . UnprocessedKeys { pageError = c . BatchGetIterator ( ctx , c . ToBatchGetItemInput ( tbl , unprocessed . Keys ) , fn ) if pageError != nil { return false } } return true } ) if err != nil { return err } if pageError != nil { return pageError } return nil }
BatchGetIterator retrieves all items from the batch get input
BatchGetIterator retrieves all items from the batch get input