Socket
Socket
Sign inDemoInstall

dynamo-helper

Package Overview
Dependencies
37
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dynamo-helper

Easy DynamoDB helper


Version published
Maintainers
1
Install size
6.88 kB
Created

Readme

Source

DynamoHelper

This is a tiny module that eases calls to DynamoDB. It includes only the most frequently-used calls I make, along with configuration I often use. Could be useful for someone else, but I'm hosting it here for easier installation and updates between projects. :)

const DynamoHelper = require('dynamo-helper');
DynamoHelper.scan(...);
DynamoHelper.add(...);
DynamoHelper.get(...);
DynamoHelper.delete(...);

Installation

npm install dynamo-helper

Functions

add

Calls update for an item. It crafts the UpdateStatement based on the keys and values of the object parameter.

Parameters:

  • tableName (String)
  • idProperty (String) - The name of the hash field.
  • idValue (String) - The actual value of the id.
  • object (Map) - The object to insert or update.

Returns:

Promise(item) - A promise which will resolve with the added item, or an error if one occurred.

scan

Scans a given table. Optionally accepts an index name and filters. Currently does not support paging.

Parameters:

  • tableName (String)
  • indexName (String, optional) - A secondary index to use.
  • filters (Map, optional) - The filters to be added to FilterExpression and ExpressionAttributeValues.
  • projection (String, optional) - A ProjectionExpression to filter result columns.

Returns:

Promise({
    items: [...],
    count: 
})

The items are an array of scanned rows (which may be filtered). The count represents the TotalCount.

get

Get by id.

Parameters:

  • tableName (String)
  • idProperty (String) - The name of the hash field.
  • idValue (String) - The actual value of the id.

Returns:

Promise(item) - A promise which will resolve with the item or null (if none was found).

delete

Delete by id.

Parameters:

  • tableName (String)
  • idProperty (String) - The name of the hash field.
  • idValue (String) - The actual value of the id.

Returns:

Promise(item) - A promise which will resolve with the deleted item.

Keywords

FAQs

Last updated on 24 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc