1.1.1 • Published 7 years ago

aws-simpledb-query-builder v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

AWS SimpleDB Query Builder

This is a tested, working query builder that supports the current spec of simpledb.

How to use

Quick start

TypeScript example:

import { Order, Predicate, Query } from 'aws-node-query-builder';

Query.select('foo')
  .from('bar')
  .where(Predicate.and([
      Predicate.ne('baz', 'a'),
      Predicate.or([
          Predicate.eq('qux', 'b'),
          Predicate.eq('qux', 'c'),
      ])
  ]))
  .orderBy('itemName()', Order.DESC)
  .limit(10)
  .toQueryString();
// select `foo` from `bar` where (`baz` != 'a') and (`qux` = 'b' or `qux` = 'c') order by itemName() desc limit 10

JavaScript (node) example:

var qb = require('aws-node-query-builder');

qb.Query.select('foo')
  .from('bar')
  .where(qb.Predicate.and([
      qb.Predicate.ne('baz', 'a'),
      qb.Predicate.or([
          qb.Predicate.eq('qux', 'b'),
          qb.Predicate.eq('qux', 'c'),
      ])
  ]))
  .orderBy('itemName()', qb.Order.DESC)
  .limit(10)
  .toQueryString();
// select `foo` from `bar` where (`baz` != 'a') and (`qux` = 'b' or `qux` = 'c') order by itemName() desc limit 10

Supported queries

and([predicate1, predicate2...])

or([predicate1, predicate2...])

not(predicate) // not(predicate)

intersect([predicate1, predicate2...])

every(predicate) // every(attr)...

eq(attr, value) // attr = value

ne(attr, value) // attr != value

like(attr, value) // attr like value

notLike(attr, value) // attr not like value

between(attr, lb, ub) // attr between lb and ub

isNull(attr) // is null

notNull(attr) // is not null

isNull(attr) // is null

valueIn(attr, [value1, value2...]) // attr in (value1, value2...)

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago