@letsgo/db
This package facilitates access to the LetsGo database. It provides a simple set of CRUD operations as well as a simple query interface.
▸ deleteItem(category
, key
, options?
): Promise
<void
>
Ensures the item is deleted. If the item does not exist, this operation is a no-op.
Name | Type | Description |
---|---|---|
category |
string |
The partition key |
key |
string |
The sort key |
options? |
DeploymentOptions |
Options for the operation |
Promise
<void
>
▸ getItem<T
>(category
, key
, options?
): Promise
<T
| undefined
>
Retrieves a single item from the database.
Name | Type |
---|---|
T |
extends DBItem |
Name | Type | Description |
---|---|---|
category |
string |
The partition key |
key |
string |
The sort key |
options? |
GetItemOptions |
Options for the operation |
Promise
<T
| undefined
>
A promise that resolves to the item or undefined if the item does not exist or has expired.
▸ listItems<T
>(category
, keyPrefix
, options?
): Promise
<ListItemsResult
<T
>>
Lists items in the database that match the given category and key prefix. This function suports pagination.
Name | Type |
---|---|
T |
extends DBItem |
Name | Type | Description |
---|---|---|
category |
string |
The partition key |
keyPrefix |
string |
The prefix of the sort key |
options? |
ListItemsOptions |
Options for the operation |
Promise
<ListItemsResult
<T
>>
Matching items an an optional continuation token for paginated results.
▸ putItem<T
>(item
, options?
): Promise
<void
>
Upserts an item in the database.
Name | Type |
---|---|
T |
extends DBItem |
Name | Type | Description |
---|---|---|
item |
T |
The item to upsert |
options? |
DeploymentOptions |
Options for the operation |
Promise
<void
>