Yet another simple query builder for DynamoDB. Give it a try!
npm install --save eudynamys
eudynamys
requires Node 6+.
const AWS = require('aws-sdk');
const dbDocClient = new AWS.DynamoDB.DocumentClient();
const QueryBuilder = require('eudynamys');
const qb = new QueryBuilder(dbDocClient);
You can pass a debug function as 2nd parameter of QueryBuilder
constructor. It will displays the parameters passed to DynamoDB document client. Use either console.log
or a custom logger.
const qb = new QueryBuilder(dbDocClient, console.log);
table(tableName)
,from(tableName)
Select a tableindex(indexName)
Select an indexitem(object = {})
Define an item to putselect(attributeName = '')
Attributes to fetchexclusiveStartKey(key)
In order to loopscanIndexForward(value)
To define the order for traversal indexlimit(number)
Maximum number of itemscount()
Countwhere(keyAttributeName = '')
Wherefilter(attributeName = '')
Filterif(attributeName = '')
Ifmatch(joiSchema = {})
Match a Joi schemaequals(...args)
,eq(...args)
Equalsne(...args)
Not equalslte(...args)
Lower than or equallt(...args)
Lower thangte(...args)
Greater than or equalgt(...args)
Greater thanbetween(...args)
Betweenin(...args)
Inand(...args)
Andor(...args)
Ornot(...args)
Notop(...args)
Open parenthesiscp(...args)
Close parenthesis
put()
update()
query()
scan()
get()
qb.select(['uuid', 'title', 'createdAt'])
.from('sample')
.where('key').eq('8e7d307b-4e1b-4f26-984b-dfc2b35bdbbc')
.filter('published').eq(false)
.and().begins('type', 'Ty')
.and('createdAt').gt(1457278812)
.query();
npm run lint
Requires node 8+. Will install a DynamoDB local server using dynamodb-localhost, create and seed a table, and validate results.
npm run test