Skip to content

Add conditional save, update and delete operation support for DynamoDB entities. Fixes #gh-1147 #1371

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vyomrastogi
Copy link

@vyomrastogi vyomrastogi commented Apr 13, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

  • Add a save(PutItemEnhancedRequest) to support item put conditionally
  • Add a update(UpdateItemEnhancedRequest) to support item update conditionally
  • Add a delete(DeleteItemEnhancedRequest) to support item delete conditionally

💡 Motivation and Context

At the moment DynamoDbOperation does not support conditional actions on an Entity. This would mean that developers need to get an instance of DynamoDbTable to execute lower level aws sdk methods.

The new convenience methods allow for EnhancedRequest to be executed via DynamoDbOperation.

Fixes issue #1147

💚 How did you test it?

Validated changes via Integration Tests.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated reference documentation to reflect the change
  • All tests passing
  • No breaking changes

🔮 Next steps

@github-actions github-actions bot added the component: dynamodb DynamoDB integration related issue label Apr 13, 2025
*
* @see PutItemEnhancedRequest
*/
<T> void save(PutItemEnhancedRequest<T> putItemEnhancedRequest, Class<T> clazz);
Copy link
Author

@vyomrastogi vyomrastogi Apr 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Reviewers,

Here I opted to make this method void as DynamoDbTable.putItem does not return updated entity. There is possibility if someone is using extensions then the entity would have been update at db layer and hence passed entity would not hold latest state.

This deviates from set norm, so happy to adapt to maintain consistency. What's your recommendation ?

@vyomrastogi vyomrastogi changed the title Add save dynamodb entity with PutItemEnhancedRequest. Fixes gh-1147 Add EnhancedRequest support for dynamoDb entities. Fixes gh-1147 Apr 13, 2025
@vyomrastogi vyomrastogi changed the title Add EnhancedRequest support for dynamoDb entities. Fixes gh-1147 Add *EnhancedRequest support for dynamoDb entities. Fixes #gh-1147 Apr 13, 2025
@vyomrastogi vyomrastogi changed the title Add *EnhancedRequest support for dynamoDb entities. Fixes #gh-1147 Add conditional save, update and delete operation support for DynamoDB entities. Fixes #gh-1147 Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dynamodb DynamoDB integration related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant