Anabode
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