Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support BatchGetItem and BatchWriteItem #34

Merged
merged 4 commits into from
Dec 23, 2022
Merged

Support BatchGetItem and BatchWriteItem #34

merged 4 commits into from
Dec 23, 2022

Conversation

kitar
Copy link
Owner

@kitar kitar commented Dec 13, 2022

Working on an implementation for BatchGetItem and BatchWriteItem, inspired by these experiments: #25, #32.
(Closes #32, closes #33)

Usage

via query builder

$query->batchGetItem($keys);
$query->batchWriteItem($requestItems);

// handy methods for batchWriteItem
$query->batchPutItem($items);
$query->batchDeleteItem($keys);

via Model

MyModel::batchGetItem($keys);
MyModel::batchWriteItem($requestItems);

// handy methods for batchWriteItem
MyModel::batchPutItem($items);
MyModel::batchDeleteItem($keys);

Params

$keys

Array of keys to get or delete. For example:

[
  [
    'PK' => 'ITEM#',
    'SK' => 'ITEM#1',
  ],
  // ...
]

$items

Array of items to put. For example:

[
  [
    'PK' => 'ITEM#',
    'SK' => 'ITEM#1',
    'attribute1' => 'foo',
    'attribute2' => 'bar',
  ],
  // ...
]

$requestItems

RequestItems (not marshaled) to pass directly to BatchWriteItem. For example:

[
  [
    'PutRequest' => [
      'Item' => [
        'PK' => 'ITEM#',
        'SK' => 'ITEM#1',
        'attribute1' => 'foo',
        'attribute2' => 'bar',
      ],
    ],
  ],
  [
    'DeleteRequest' => [
      'Item' => [
        'PK' => 'ITEM#',
        'SK' => 'ITEM#1',
      ],
    ],
  ],
]

@kitar kitar marked this pull request as ready for review December 23, 2022 05:46
@kitar kitar merged commit 83dfe30 into master Dec 23, 2022
@negoziator
Copy link
Contributor

Nice work @kitar 😎😍

@kitar kitar deleted the batch-write-item branch February 14, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support BatchGetItem/BatchWriteItem where -> delete
2 participants