@anabode/dynamodb_service

dynamodb abstraction

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@anabode/dynamodb_service
Minified + gzip package size for @anabode/dynamodb_service in KB

Readme

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.