-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk)!: improve dynamodb table resource (#4242)
Adds the DynamoDBTable query command, and changes the scan command as well. BREAKING CHANGE: the response of the DynamoDBTable scan command now returns an object that contains the items (and other stuff) instead of returning the items directly
- Loading branch information
Showing
10 changed files
with
1,264 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*\ | ||
skipPlatforms: | ||
- win32 | ||
- darwin | ||
\*/ | ||
|
||
bring ex; | ||
|
||
let t1 = new ex.DynamodbTable(name: "test1", attributeDefinitions: { "k1": "S", "k2": "S" }, hashKey: "k1", rangeKey: "k2"); | ||
|
||
test "query" { | ||
t1.putItem({ | ||
"k1": "key1", | ||
"k2": "value1", | ||
"k3": "other-value1" | ||
}); | ||
t1.putItem({ | ||
"k1": "key1", | ||
"k2": "value2", | ||
"k3": "other-value2" | ||
}); | ||
|
||
let result = t1.query( | ||
keyConditionExpression: "k1 = :k1", | ||
expressionAttributeValues: { | ||
":k1": "key1", | ||
}, | ||
); | ||
|
||
assert(result.count == 2); | ||
assert(result.items.at(0).get("k1") == "key1"); | ||
assert(result.items.at(0).get("k2") == "value1"); | ||
assert(result.items.at(0).get("k3") == "other-value1"); | ||
assert(result.items.at(1).get("k1") == "key1"); | ||
assert(result.items.at(1).get("k2") == "value2"); | ||
assert(result.items.at(1).get("k3") == "other-value2"); | ||
} |
Oops, something went wrong.