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: README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,12 @@ All you need to do is to decide the struct conforming `BreezeCodable` to persist
69
69
70
70
Each lambda will be initialized with a specific `_HANDLER` and it will run the code to implement the required logic needed by one of the CRUD functions. The code needs to be packaged and deployed using the referenced architecture.
71
71
72
+
### Optimistic locking
73
+
74
+
Optimistic locking is a strategy to ensure that the BreezeCodable Item is not updated by another request before updating or deleting it.
75
+
The fields `updatedAt` and `createdAt` are used to implement optimistic locking.
76
+
Refer to the [DynamoDB documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.OptimisticLocking.html) for more details.
77
+
72
78
## Lambda package with Swift Package Manager
73
79
74
80
To package the Lambda is required to create a Swift Package using the following `Package.swift` file.
@@ -303,12 +309,12 @@ Returns the updated `BreezeCodable`.
303
309
304
310
- `delete`
305
311
306
-
Gets the value of the `BreezeCodable.key` from the `APIGatewayV2Request.pathParameters` dictionary and calls `deleteItem` on `BreezeDynamoDBService`.
312
+
Gets the value of the `BreezeCodable.key` from the `APIGatewayV2Request.pathParameters` dictionary, the value of `updatedAt` and `createdAt` from `APIGatewayV2Request.queryStringParameters` dictionary and calls `deleteItem` on `BreezeDynamoDBService`.
307
313
Returns the `BreezeCodable` if persisted on DynamoDB.
308
314
309
315
- `list`
310
316
311
-
Gets the value of the `exclusiveStartKey` and `limit` from the `APIGatewayV2Request.pathParameters` dictionary and calls `listItems` on `BreezeDynamoDBService`.
317
+
Gets the value of the `exclusiveStartKey` and `limit` from the `APIGatewayV2Request.queryStringParameters` dictionary and calls `listItems` on `BreezeDynamoDBService`.
312
318
Returns the `ListResponse` containing the items if persisted on DynamoDB.
0 commit comments