You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/VersionedRecordExtension.java
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/annotations/DynamoDbVersionAttribute.java
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,10 @@
27
27
* Denotes this attribute as recording the version record number to be used for optimistic locking. Every time a record
28
28
* with this attribute is written to the database it will be incremented and a condition added to the request to check
29
29
* for an exact match of the old version.
30
+
* <p>
31
+
* <b>Version Calculation:</b> The first version written to a new record is calculated as {@code startAt + incrementBy}.
32
+
* For example, with {@code startAt=0} and {@code incrementBy=1} (defaults), the first version is 1.
33
+
* To start versioning from 0, use {@code startAt=-1} and {@code incrementBy=1}, which produces first version = 0.
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/extensions/VersionedRecordExtensionTest.java
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -653,6 +653,26 @@ public void updateItem_existingRecordWithVersionEqualToStartAt_shouldSucceed() {
653
653
is("attribute_not_exists(#AMZN_MAPPED_version) OR #AMZN_MAPPED_version = :old_version_value"));
Copy file name to clipboardExpand all lines: services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/functionaltests/VersionedRecordTest.java
+93Lines changed: 93 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,24 @@ public AnnotatedRecord setAttribute(String attribute) {
0 commit comments