7.10.0 • Published 10 years ago

odoql v7.10.0

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

OdoQL

OdoQL is an extendible, composable and modular JSON query language.

This module (odoql) can build JSON queries with no additional dependencies. Use odoql-exe and other providers to execute queries. Or build additional execution environments in languages other than javascript.

Usage

Define a query

var ql = require('odoql');
ql = ql
  .use('csv')
  .use('http');

var query = ql('http://samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv')
  .http()
  .csv({
    header: true,
    skipEmptyLines: true
  })
  .assign({
    sq__ft: ql.asFloat(ql.ref('sq__ft'))
  })
  .filter(ql.gt(ql.ref('sq__ft'), 1000))
  .shape({
    street: true
  })
  .query();

console.log(JSON.stringify(query, null, 2));

Raw JSON format can be sent to a server or saved.

{
  "__q": "shape",
  "__p": {
    "street": true
  },
  "__s": {
    "__q": "filter",
    "__p": {
      "__q": "gt",
      "__l": {
        "__q": "ref",
        "__s": "sq__ft"
      },
      "__r": 1000
    },
    "__s": {
      "__q": "assign",
      "__p": {
        "sq__ft": {
          "__q": "asFloat",
          "__s": {
            "__q": "ref",
            "__s": "sq__ft"
          }
        }
      },
      "__s": {
        "__q": "csv",
        "__p": {
          "header": true,
          "skipEmptyLines": true
        },
        "__s": {
          "__q": "http",
          "__s": "http://samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv"
        }
      }
    }
  }
}

Execute a JSON query:

var exe = require('odoql-exe');
exe = exe()
  .use(require('odoql-csv'))
  .use(require('odoql-http'));

var run = exe.build(query);

run(function(err, results) {
  console.log(results);
});

This is just the start, see OdoQL Exe source for other components including caching, dynamic queries and parrallel queries. See Odo Relay to integrate OdoQL into Odo.js

7.10.0

10 years ago

7.9.0

10 years ago

7.8.0

10 years ago

7.7.0

10 years ago

7.6.0

10 years ago

7.5.0

10 years ago

7.4.0

10 years ago

7.3.1

10 years ago

7.3.0

10 years ago

7.2.1

10 years ago

7.2.0

10 years ago

7.1.0

10 years ago

7.0.1

10 years ago

6.0.0

10 years ago

5.1.2

10 years ago

5.1.1

10 years ago

5.1.0

10 years ago

5.0.1

10 years ago

5.0.0

10 years ago

4.0.0

10 years ago

3.1.0

10 years ago

3.0.0

10 years ago

2.0.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago