Alternator
A simplified API to DynamoDB
State - Experimental
DynamoDB is hard to figure out and the state of the docs really doesn't help. Use this module at your own risk!
Usage
var alternator = require('alternator');
var db = alternator(
{
endpoint: new AWS.Endpoint('http://localhost:8000'),
accessKeyId: "myKeyId",
secretAccessKey: "secretKey",
region: "us-east-1"
},
[
{
name: 'users',
key: {
name: 'hash',
version: 'range'
},
attributes: {
name: 'string',
version: 'number'
}
}
]
);
db.table('users').create({
name: 'bob',
version: 0
}, callback);
db.table('users').get({
key: {
name: 'bob',
version: 0
}
}, callback);
db.table('users').findAll({
key: {
name: 'bob'
}
}, callback);
db.table('users').scan({
expression: 'foo = :foo',
attributeValues: {
':foo': 'bar'
}
}, callback);
db.table('users').update({
key: {
name: 'bob',
version: 0
}
item: {
version: 1
}
}, callback);
db.table('users').update({
key: {
name: 'bob',
version: 0
}
expression: 'ADD version :one',
attributeValues: {
':one': 1
}
}, callback);
db.table('users').remove({
key: {
name: 'bob',
version: 0
}
}, callback);