Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabienjuif/dynamo-client
An opinionated async/await wrapper to AWS dynamo client (document)
https://github.com/fabienjuif/dynamo-client
aws document documents dynamo dynamodb helper nantes promises wrapper
Last synced: 20 days ago
JSON representation
An opinionated async/await wrapper to AWS dynamo client (document)
- Host: GitHub
- URL: https://github.com/fabienjuif/dynamo-client
- Owner: fabienjuif
- Created: 2020-04-26T14:46:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T04:27:14.000Z (about 2 years ago)
- Last Synced: 2024-12-15T15:16:59.517Z (25 days ago)
- Topics: aws, document, documents, dynamo, dynamodb, helper, nantes, promises, wrapper
- Language: JavaScript
- Homepage:
- Size: 2.28 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @fabienjuif/dynamo-client
> An opinionated async/await wrapper to AWS dynamo client (document)
## API
First, you have to create a client:
```js
import { createClient } from '@fabienjuif/dynamo-client'// createClient(region, apiVersion)
// - default region is process.env.AWS_REGION
// - default apiVersion is 2012-08-10
const dynamoClient = createClient()
```### delete
```js
// collection(tableName, key = 'id')
// - key can be a string if you only use a partition key
// - or it can be an array if you use a partition and a sort key
// delete(keyValue)
await dynamoClient.collection('my-collection').delete('my-id')
```### get
```js
// get(keyValue, projectionKeys = undefined)
await dynamoClient.collection('my-collection').get('my-id')
await dynamoClient.collection('my-collection').get('my-id', ['id', 'name'])
```### put
```js
await dynamoClient.collection('my-collection').put({
id: 'my-id',
name: 'name !!',
})
```### update
```js
// update(data)
await dynamoClient.collection('my-collection').update({
id: 'my-id',
name: 'name !!',
score: undefined, // this field will be removed
})
```### query
```js
// query(keys)
await dynamoClient.collection('my-collection').query('my-partition-id')
```