Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Siphon.IO Query Language
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
LICENSE.md
README.md
example.js
index.js
package.json

README.md

SIQL

Siphon.IO Query Language (pronounced like "cycle")

Overview

This module allows for programmatic transformation and usage of SIQL queries. SIQL is a query language based on JSON used to interact with various siphon.io services.

Installation

Available via npm:

$ npm install siql

Or via git:

$ git clone git://github.com/deoxxa/node-siql.git node_modules/siql

API

mergeQueries

Merges a list of queries into one, retaining the semantics of any restrictions in place on earlier queries in the list.

siql.mergeQueries(queries);
var merged = siql.mergeQueries([query1, query2]);

Arguments

  • queries - an array of query objects.

Example

Also see example.js.

var siql = require("siql");

var queries = [
  {fields: {a: true, b: true, c: true}, condition: {type: "eq", left: "a", right: 5}, sort: [["time", -1]], limit: 100},
  {fields: {a: true, b: true, c: true}, condition: {type: "eq", left: "b", right: 5}, limit: 1000},
  {fields: {a: true, b: true, c: true}, condition: {type: "eq", left: "c", right: 5}, limit: 500},
];

var query = siql.mergeQueries(queries);

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

Output:

{
  "condition": {
    "type": "and",
    "data": [
      {
        "type": "eq",
        "left": "a",
        "right": 5
      },
      {
        "type": "eq",
        "left": "b",
        "right": 5
      },
      {
        "type": "eq",
        "left": "c",
        "right": 5
      }
    ]
  },
  "fields": {
    "a": true,
    "b": true,
    "c": true
  },
  "sort": [
    [
      "time",
      -1
    ]
  ],
  "limit": 100
}

License

3-clause BSD. A copy is included with the source.

Contact

Something went wrong with that request. Please try again.