eudynamys
Yet another simple query builder for DynamoDB. Give it a try!
Install
npm install --save eudynamys
eudynamys
requires Node 6+.
Usage
Instantiate the client
const AWS = ;const dbDocClient = ;const QueryBuilder = ;const qb = dbDocClient;
Debug
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 = dbDocClient consolelog;
API
this
Filters and methods return 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
Promise
resolved with DynamoDB
response.
Actions, return a put()
update()
query()
scan()
get()
Example
qb ;
Lint
npm run lint
Test
Requires node 8+. Will install a DynamoDB local server using dynamodb-localhost, create and seed a table, and validate results.
npm run test