tower-query

0.1.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i tower-query

Weekly Downloads

8

Version

0.1.1

License

none

Last publish

Collaborators

  • viatropos