@anabode/dynamodb_service

1.0.10 • Public • Published

Anabode

N|Solid

Service Layer Abstraction for DynamoDB CRUD operations

Current Iteration

Uses DynamoDBDocClient SDK for easier object mapping

Recommending that one always uses ConditionalExpression to check for update/delete constraints.

This library will not do that for you, it is up to your model implementation to do that

Current Methods

  • Get
    • Can be used for any non Anabode business logic related CRUD operation
  • Query
  • Delete
  • Update (Uses PutItem)
  • UpdateInPlace (uses PutItem)

Usage Tips

var modelRequest = {
                        TableName: "",
                        Key: {
                           ["primaryKeyName"]: "",
                           //["rangeKey"]: ""

                        }
                    }
var conf = {aws: {region: "", accessKeyId:"", secretAccessKey:""}}

var srv = new (require('@anabode/dynamodb_service'))(conf);

/// inside a function with callback or promise 
srv.getItem(modelRequest, (e,d) => {
    return callback(e,d);
})

if no callback is passed than a promise is returned

srv.queryItem(modelRequest)
    .then((data) => {
        return data
    })
    .catch((err) => {
        return err
    })

Todos

  • Write MORE Tests
  • More Tyding up is needed

License

WTFPL

Readme

Keywords

none

Package Sidebar

Install

npm i @anabode/dynamodb_service

Weekly Downloads

1

Version

1.0.10

License

WTFPL

Unpacked Size

8.18 kB

Total Files

5

Last publish

Collaborators

  • seanyda
  • dnitsch
  • drioemgaoin