Skip to content

Commit

Permalink
Add basic documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tgandrews committed Jan 26, 2021
1 parent 9d1ad26 commit 2120a78
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Once you have defined your store you can create models from it and unless you pr
will be created for you automatically as the `omanyd.types.id()` was used in the [definition above](#Define%20a%20model)

```ts
const tweet = TweetStore.create({ content: "My first tweet" });
const tweet = await TweetStore.create({ content: "My first tweet" });
console.log(tweet);
/*
* { id: "958f2b51-774a-436a-951e-9834de3fe559", content: "My first tweet" }
Expand All @@ -141,7 +141,7 @@ console.log(tweet);
Now that we have some data in the store we can now read it. The quickest way is reading directly by the hash key.

```ts
const readTweet = TweetStore.getByHashKey(
const readTweet = await TweetStore.getByHashKey(
"958f2b51-774a-436a-951e-9834de3fe559"
);
console.log(readTweet);
Expand Down Expand Up @@ -189,6 +189,21 @@ console.log(updatedTweet);
*/
```

### Deleting an item

Now lets get rid of what we have created.

```ts
await TweetStore.deleteByHashKey("958f2b51-774a-436a-951e-9834de3fe559");
const readTweet = await TweetStore.getByHashKey(
"958f2b51-774a-436a-951e-9834de3fe559"
);
console.log(readTweet);
/*
* null
*/
```

## Advanced Features

### Range keys
Expand Down

0 comments on commit 2120a78

Please sign in to comment.