npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eudynamys

v1.0.4

Published

A simple query builder for DynamoDB

Downloads

5

Readme

eudynamys

license npm version CircleCI codecov NSP Status

NPM

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 = require('aws-sdk');
const dbDocClient = new AWS.DynamoDB.DocumentClient();
const QueryBuilder = require('eudynamys');
const qb = new QueryBuilder(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 = new QueryBuilder(dbDocClient, console.log);

API

Filters and methods return this

  • table(tableName), from(tableName) Select a table
  • index(indexName) Select an index
  • item(object = {}) Define an item to put
  • select(attributeName = '') Attributes to fetch
  • exclusiveStartKey(key) In order to loop
  • scanIndexForward(value) To define the order for traversal index
  • limit(number) Maximum number of items
  • count() Count
  • where(keyAttributeName = '') Where
  • filter(attributeName = '') Filter
  • if(attributeName = '') If
  • match(joiSchema = {}) Match a Joi schema
  • equals(...args), eq(...args) Equals
  • ne(...args) Not equals
  • lte(...args) Lower than or equal
  • lt(...args) Lower than
  • gte(...args) Greater than or equal
  • gt(...args) Greater than
  • between(...args) Between
  • in(...args) In
  • and(...args) And
  • or(...args) Or
  • not(...args) Not
  • op(...args) Open parenthesis
  • cp(...args) Close parenthesis

Actions, return a Promise resolved with DynamoDB response.

  • put()
  • update()
  • query()
  • scan()
  • get()

Example

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();

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