Open goozler opened 7 years ago
#save
doesn't yet expose this functionality, but i think it should. The tricky part is how we want to expose the condition expression. I'm going to chew on this a bit - one possible option that solves this generically is maybe an :override_parameters
option that is passed in to save, that lets you override any of the underlying client parameters. In this manner, you could provide conditional expressions, or for that matter, alter any other underlying client option if you know what you're doing. It wouldn't preclude other params that do this in a higher level way either.
Okay, after some discussions, I think the plan will be to expose select parameters individually (override parameters causes nasty collision issues with existing helper functionality).
For example, you could append to existing conditions, and the condition expression would look kind of like:
"#{aws_record_condition_expression} AND (#{user_provided_condition_expression})"
..and then we would merge the expression attribute name and value hashes.
Any update on this?
We're going to work this in with smart query/scan support that I'm working on.
Hi! Is there any way to do a conditional put request? The case when I get some data, change it by some operations and I want to save it back only if data in DynamoDB still the same when I get it.
Maybe you could give me an advice how to implement it with a few changes.