Note: Under the hood, items are inserted in batches of 25 items. It is recommended to group all your items together into one feedTable call as much as possible for performance.
The items parameter is an object of which the keys represent table names, and the values a DynamoDBItemCollection.
Note: Under the hood, items are inserted in batches of 25 items. It is recommended to group all your items together into one feedTables call as much as possible for performance.
truncateTable(tableName: string, keys?: string[])
Deletes all the items from a table. It is useful for cleaning up data between tests.
keys represent the primary key (Partition Key and, optionally, the Sort Key). If not passed, sls-jest will try to infer it from the table description.
example:
Types
For TypeScript users, some types are also exported for your convenience.
DynamoDBItem
Represents a single DynamoDB item, represented as a plain JS object.
example:
DynamoDBItemCollection
Represents a collection of DynamoDBItem. It can be:
An array of DynamoDBItem (DynamoDBItem[])
example:
A dictionary of DynamoDBItem or DynamoDBItem[]
The key has no meaning and no impact on how the data that is actually stored in the table, but it can be useful for readability and/or to access items later easily.