Skip to content

Latest commit

 

History

History
140 lines (85 loc) · 3.41 KB

README.md

File metadata and controls

140 lines (85 loc) · 3.41 KB

@letsgo/db

@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.

Table of contents

Interfaces

Functions

Functions

deleteItem

deleteItem(category, key, options?): Promise<void>

Ensures the item is deleted. If the item does not exist, this operation is a no-op.

Parameters

Name Type Description
category string The partition key
key string The sort key
options? DeploymentOptions Options for the operation

Returns

Promise<void>

Defined in

index.ts:180


getItem

getItem<T>(category, key, options?): Promise<T | undefined>

Retrieves a single item from the database.

Type parameters

Name Type
T extends DBItem

Parameters

Name Type Description
category string The partition key
key string The sort key
options? GetItemOptions Options for the operation

Returns

Promise<T | undefined>

A promise that resolves to the item or undefined if the item does not exist or has expired.

Defined in

index.ts:135


listItems

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.

Type parameters

Name Type
T extends DBItem

Parameters

Name Type Description
category string The partition key
keyPrefix string The prefix of the sort key
options? ListItemsOptions Options for the operation

Returns

Promise<ListItemsResult<T>>

Matching items an an optional continuation token for paginated results.

Defined in

index.ts:201


putItem

putItem<T>(item, options?): Promise<void>

Upserts an item in the database.

Type parameters

Name Type
T extends DBItem

Parameters

Name Type Description
item T The item to upsert
options? DeploymentOptions Options for the operation

Returns

Promise<void>

Defined in

index.ts:161