tower-query

Query anything, anywhere.

npm install tower-query
2 downloads in the last day
32 downloads in the last week
121 downloads in the last month

Tower Query API

Query anything, anywhere.

Installation

node.js:

$ npm install tower-query

browser:

$ component install tower/query

Examples

Select records:

var query = require('tower-query');

query()
  .use('memory')
  .select('post')
  .where('likeCount').gte(10)
  .where('likeCount').lte(200)
  .all(function(err, posts){

  });

Create record(s):

query()
  .use('memory')
  .select('post')
  .create({ title: 'Foo' }, function(err, post){

  });

Other actions update and remove work similarly.

The query delegates to adapters for these actions, which should return a stream-compatible API, such as a node.js stream, tower-stream, tower-program, or tower-topology. This is how .find looks at a lower level:

query()
  .use('mongodb')
  .select('post')
  .action('find')
  .exec()
  .on('data', function(posts){

  })
  .on('end', function(){
    console.log('done querying');
  });

License

MIT

npm loves you