repository.dynamodb
A generic repository pattern for dynamodb written for node.js
Usage
Construct the Repository using the aws region, dynamoDb table name, name of the id key and optionally name of the range key.
With both id and range
let Repository = ;let repository = 'eu-west-1' 'tableone' 'id' 'range';
With just id
let Repository = ;let repository= 'eu-west-1' 'tableone' 'id';
API
repository;repository;repository;repository;repository;
Extending
If you want to provide an additional function specific to your repository, the dynamodb docClient
is provided:
repository { let params = TableName: 'news' ExpressionAttributeNames: "#D": "date" "#E": "expiration" ExpressionAttributeValues: ":NOW": FilterExpression: ':NOW between #D and #E' ; thisdocClient;};