Comparing version 1.1.0 to 1.3.0
{ | ||
"name": "xql", | ||
"version": "1.1.0", | ||
"version": "1.3.0", | ||
"license": "Unlicense", | ||
"engines": { "node": ">=4" }, | ||
@@ -36,5 +37,2 @@ "description": "SQL builder and utilities library designed to work with PostgreSQL.", | ||
"engines": { "node": ">=4" }, | ||
"devDependencies": { "mocha": "*" }, | ||
"repository" : { | ||
@@ -41,0 +39,0 @@ "type": "git", |
xql.js | ||
====== | ||
SQL builder and utilities library for node.js, [try it online](http://kobalicek.com/fiddle-xql.html). | ||
SQL builder and utilities library for node.js. | ||
* [Official Repository (exjs/xql)](https://github.com/exjs/xql) | ||
* [Public Domain (unlicense.org)](https://unlicense.org) | ||
* [Official Chat (gitter)](https://gitter.im/exjs/exjs) | ||
* [Official Fiddler](https://kobalicek.com/fiddle-xql.html) | ||
* [Public Domain (https://unlicense.org)](https://unlicense.org) | ||
@@ -108,7 +110,8 @@ Disclaimer | ||
`xql.node.Raw` | Raw SQL expression | ||
`xql.node.Unary` | Unary SQL node (can contain a single child) | ||
`xql.node.Binary` | Binary SQL node (can contain two children, left and right) | ||
`xql.node.Operator` | SQL operator, like `=`, `+`, `-`, etc... | ||
`xql.node.Group` | Group of SQL nodes | ||
`xql.node.Logical` | Logical operator (Group), like `AND`, `OR`, etc... | ||
`xql.node.Unary` | SQL unary node (can contain a single child) | ||
`xql.node.UnaryOp` | SQL unary operator, like `-`, `NOT`, etc... | ||
`xql.node.Binary` | SQL binary node (can contain two children, left and right) | ||
`xql.node.BinaryOp` | SQL binary operator, like `=`, `+`, `-`, etc... | ||
`xql.node.NodeArray` | Contains array of nodes or values | ||
`xql.node.Logical` | Logical operator like `AND` and `OR`, which is based on `NodeArray` and can contain more than two expressions | ||
`xql.node.ObjectOp` | Special node that contains key/value interface that can be used to construct `WHERE` like expressions | ||
@@ -118,8 +121,4 @@ `xql.node.Identifier` | SQL identifier, like table or column | ||
`xql.node.Sort` | SQL `ORDER BY` construct | ||
`xql.node.Func` | SQL function expression | ||
`xql.node.Aggregate` | SQL aggregate expression | ||
`xql.node.Func` | SQL function or aggregate expression | ||
`xql.node.Value` | SQL value base class | ||
`xql.node.PrimitiveValue` | Primitive value like `NULL`, boolean, number, or string | ||
`xql.node.ArrayValue` | Array value (can serialize as JSON or ARRAY) | ||
`xql.node.JsonValue` | JSON value (can serialize as JSON or STRING) | ||
`xql.node.Query` | SQL query base class | ||
@@ -130,3 +129,3 @@ `xql.node.SelectQuery` | SQL `SELECT` query | ||
`xql.node.DeleteQuery` | SQL `DELETE` query | ||
`xql.node.CombinedQuery` | SQL `UNION`, `INTERSECT`, and `EXCEPT` operators that can be used to combine multiple queries | ||
`xql.node.CompoundQuery` | SQL `UNION`, `INTERSECT`, and `EXCEPT` operators that can be used to combine multiple queries | ||
@@ -141,8 +140,8 @@ High-level SQL builder concepts: | ||
`xql.DELETE(...)` | Create a `xql.node.DeleteQuery` and use an optional first argument as a table name | ||
`xql.EXCEPT(...)` | Create a `xql.node.CombinedQuery` describing `EXCEPT` expression | ||
`xql.EXCEPT_ALL(...)` | Create a `xql.node.CombinedQuery` describing `EXCEPT ALL` query | ||
`xql.INTERSECT(...)` | Create a `xql.node.CombinedQuery` describing `INTERSECT` query | ||
`xql.INTERSECT_ALL(...)` | Create a `xql.node.CombinedQuery` describing `INTERSECT ALL` query | ||
`xql.UNION(...)` | Create a `xql.node.CombinedQuery` describing `UNION` query | ||
`xql.UNION_ALL(...)` | Create a `xql.node.CombinedQuery` describing `UNION ALL` query | ||
`xql.EXCEPT(...)` | Create a `xql.node.CompoundQuery` describing `EXCEPT` expression | ||
`xql.EXCEPT_ALL(...)` | Create a `xql.node.CompoundQuery` describing `EXCEPT ALL` query | ||
`xql.INTERSECT(...)` | Create a `xql.node.CompoundQuery` describing `INTERSECT` query | ||
`xql.INTERSECT_ALL(...)` | Create a `xql.node.CompoundQuery` describing `INTERSECT ALL` query | ||
`xql.UNION(...)` | Create a `xql.node.CompoundQuery` describing `UNION` query | ||
`xql.UNION_ALL(...)` | Create a `xql.node.CompoundQuery` describing `UNION ALL` query | ||
`xql.SORT(c, sort, nulls)` | Create a `xql.node.Sort` node wrapping an `ORDER BY` clause | ||
@@ -444,2 +443,2 @@ `xql.RAW(s, bindings)` | Create a RAW query `xql.node.Raw` node based on query string `s` and optional `bindings` | ||
There is a project called [xql-fiddle](http://kobalicek.com/fiddle-xql.html), which can be used to explore xql.js possibilities by playing with it online. It contains more snippets and tries to teach by examples. | ||
There is a project called [xql-fiddle](https://kobalicek.com/fiddle-xql.html), which can be used to explore xql.js possibilities by playing with it online. It contains more snippets and tries to teach by examples. |
@@ -364,3 +364,3 @@ // xql.js <https://github.com/exjs/xql> | ||
it("should test SELECT ... FROM ... OFFSET ... LIMIT ...", function() { | ||
it("should test SELECT ... FROM ... LIMIT ... OFFSET ...", function() { | ||
shouldMatch( | ||
@@ -376,3 +376,3 @@ SELECT().FROM("x").OFFSET(1), | ||
SELECT().FROM("x").OFFSET(10).LIMIT(20), | ||
'SELECT * FROM "x" OFFSET 10 LIMIT 20'); | ||
'SELECT * FROM "x" LIMIT 20 OFFSET 10'); | ||
}); | ||
@@ -485,6 +485,6 @@ | ||
// Combined query with ORDER BY and/or OFFSET/LIMIT. | ||
it("should test ... UNION ... ORDER BY ... OFFSET ... LIMIT ...", function() { | ||
it("should test ... UNION ... ORDER BY ... LIMIT ... OFFSET ...", function() { | ||
shouldMatch( | ||
UNION(SELECT("a").FROM("x"), SELECT("a").FROM("y")).ORDER_BY("a").OFFSET(10).LIMIT(10), | ||
'SELECT "a" FROM "x" UNION SELECT "a" FROM "y" ORDER BY "a" OFFSET 10 LIMIT 10'); | ||
UNION(SELECT("a").FROM("x"), SELECT("a").FROM("y")).ORDER_BY("a").OFFSET(10).LIMIT(20), | ||
'SELECT "a" FROM "x" UNION SELECT "a" FROM "y" ORDER BY "a" LIMIT 20 OFFSET 10'); | ||
}); | ||
@@ -491,0 +491,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
0
176633
8
4488
440