Skip to content

Commit

Permalink
add installation and basic usage guide
Browse files Browse the repository at this point in the history
  • Loading branch information
woltsu committed Mar 12, 2024
1 parent 1adc9d2 commit 0cbe0e1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,38 @@ Usable with AWS SDK v3 `DynamoDBDocumentClient`.
![](https://github.com/woltsu/tsynamo/blob/main/assets/demo.gif)

## Installation

Available in [NPM](https://www.npmjs.com/package/tsynamo).

```bash
npm i tsynamo
pnpm install tsynamo
yarn add tsynamo
```

## Usage

First, create the types for your DynamoDB tables:

```ts
import { PartitionKey, SortKey } from "tsynamo";

export interface DDB {
UserEvents: {
userId: PartitionKey<string>;
eventId: SortKey<number>;
eventType: string;
};
}
```

and then, pass that to the Tsynamo instance:

```ts
const tsynamoClient = new Tsynamo<DDB>({
ddbClient: dynamoDbDocumentClient,
});
```


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tsynamo",
"author": "woltsu",
"version": "0.0.2",
"version": "0.0.3",
"description": "Typed query builder for DynamoDB",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 0cbe0e1

Please sign in to comment.