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

[WIP] Adds DynamoDB Adapter #333

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: add deleteDocument support
  • Loading branch information
ajwad-shaikh committed Oct 14, 2023
commit 3c5b09a2b1c94498e997be689f211060572fdfab
8 changes: 7 additions & 1 deletion src/Database/Adapter/DynamoDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,13 @@ public function updateDocument(string $collection, Document $document): Document
*/
public function deleteDocument(string $collection, string $id): bool
{
return true;
$tableName = $this->getNamespace() . '_' . $this->filter($collection);
$document = $this->getDocument($collection, $id, [Query::select(['$id'])]);
$result = $this->client->deleteItem([
'Key' => [ '_id' => [ 'S' => $document->getInternalId() ] ],
'TableName' => $tableName,
]);
return (!!$result);
}

/**
Expand Down
Loading