cassanknex
Advanced tools
Comparing version 1.18.0 to 1.19.0
@@ -58,2 +58,4 @@ /** | ||
"tokenWhere": {"name": "tokenWhere", "grouping": "where"}, | ||
"minTimeuuidWhere": {"name": "minTimeuuidWhere", "grouping": "where"}, | ||
"maxTimeuuidWhere": {"name": "maxTimeuuidWhere", "grouping": "where"}, | ||
@@ -81,2 +83,7 @@ "orderBy": {"name": "orderBy", "grouping": "orderBy"}, | ||
"writetime": {"name": "writetime", "grouping": "aggregate"}, | ||
"dateOf": {"name": "dateOf", "grouping": "aggregate"}, | ||
"unixTimestampOf": {"name": "unixTimestampOf", "grouping": "aggregate"}, | ||
"toDate": {"name": "toDate", "grouping": "aggregate"}, | ||
"toTimestamp": {"name": "toTimestamp", "grouping": "aggregate"}, | ||
"toUnixTimestamp": {"name": "toUnixTimestamp", "grouping": "aggregate"}, | ||
@@ -83,0 +90,0 @@ "allowFiltering": {"name": "allowFiltering", "grouping": "allow"} |
{ | ||
"name": "cassanknex", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"description": "An Apache Cassandra CQL query builder with support for the DataStax NodeJS driver, written in the spirit of Knex.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,2 +107,7 @@ /** | ||
switch (aggregate.type) { | ||
case "dateOf": | ||
case "unixTimestampOf": | ||
case "toDate": | ||
case "toTimestamp": | ||
case "toUnixTimestamp": | ||
case "writetime": | ||
@@ -266,2 +271,6 @@ case "ttl": | ||
value = 'TOKEN(' + value + ')'; | ||
} else if (type === "minTimeuuidWhere") { | ||
value = 'minTimeuuid(' + value + ')'; | ||
} else if (type === "maxTimeuuidWhere") { | ||
value = 'maxTimeuuid(' + value + ')'; | ||
} | ||
@@ -390,2 +399,2 @@ switch (statement.op.toLowerCase()) { | ||
return cql; | ||
} | ||
} |
@@ -646,2 +646,4 @@ | ||
- tokenWhere | ||
- minTimeuuidWhere | ||
- maxTimeuuidWhere | ||
- set | ||
@@ -663,2 +665,7 @@ - add | ||
- writetime | ||
- dateOf | ||
- unixTimestampOf | ||
- toDate | ||
- toTimestamp | ||
- toUnixTimestamp | ||
@@ -737,2 +744,4 @@ ##### <a name="QueryModifiers-ColumnFamilies"></a>*For column family queries*: | ||
- 1.19.0 (@dekelev is killing it w/ new features :thumbsup:) | ||
- Add where clause QueryModifiers `minTimeuuidWhere` and `maxTimeuuidWhere`, and aggregation QueryModifiers `dateOf`, `unixTimestampOf`, `toDate`, `toTimestamp`, `toUnixTimestamp` per [#48](https://github.com/azuqua/cassanknex/pull/48). | ||
- 1.18.0 (Special thanks to @dekelev for these contributions) | ||
@@ -739,0 +748,0 @@ - Update project library dependencies per [#42](https://github.com/azuqua/cassanknex/pull/42). |
@@ -457,2 +457,26 @@ /** | ||
it("should compile a 'select' query string with minTimeuuid condition", function () { | ||
var cql = 'SELECT "id" FROM "cassanKnexy"."columnFamily" WHERE "id" > minTimeuuid(?);' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("id") | ||
.from("columnFamily") | ||
.minTimeuuidWhere("id", ">", 1); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select' query string with maxTimeuuid condition", function () { | ||
var cql = 'SELECT "id" FROM "cassanKnexy"."columnFamily" WHERE "id" > maxTimeuuid(?);' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("id") | ||
.from("columnFamily") | ||
.maxTimeuuidWhere("id", ">", 1); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select' query string with composite token condition", function () { | ||
@@ -520,2 +544,122 @@ | ||
it("should compile a simple 'dateOf' query string", function () { | ||
var cql = 'SELECT "foo", dateOf("foo") FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.dateOf("foo") | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select as' 'dateOf' query string", function () { | ||
var cql = 'SELECT "foo", dateOf("foo") AS "fooDateOf" FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.dateOf({foo: "fooDateOf"}) | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a simple 'unixTimestampOf' query string", function () { | ||
var cql = 'SELECT "foo", unixTimestampOf("foo") FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.unixTimestampOf("foo") | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select as' 'unixTimestampOf' query string", function () { | ||
var cql = 'SELECT "foo", unixTimestampOf("foo") AS "fooUnixTimestampOf" FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.unixTimestampOf({foo: "fooUnixTimestampOf"}) | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a simple 'toDate' query string", function () { | ||
var cql = 'SELECT "foo", toDate("foo") FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toDate("foo") | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select as' 'toDate' query string", function () { | ||
var cql = 'SELECT "foo", toDate("foo") AS "fooToDate" FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toDate({foo: "fooToDate"}) | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a simple 'toTimestamp' query string", function () { | ||
var cql = 'SELECT "foo", toTimestamp("foo") FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toTimestamp("foo") | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select as' 'toTimestamp' query string", function () { | ||
var cql = 'SELECT "foo", toTimestamp("foo") AS "fooToTimestamp" FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toTimestamp({foo: "fooToTimestamp"}) | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a simple 'toUnixTimestamp' query string", function () { | ||
var cql = 'SELECT "foo", toUnixTimestamp("foo") FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toUnixTimestamp("foo") | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a 'select as' 'toUnixTimestamp' query string", function () { | ||
var cql = 'SELECT "foo", toUnixTimestamp("foo") AS "fooToUnixTimestamp" FROM "cassanKnexy"."columnFamily";' | ||
, qb = cassanKnex("cassanKnexy"); | ||
qb.select("foo") | ||
.toUnixTimestamp({foo: "fooToUnixTimestamp"}) | ||
.from("columnFamily"); | ||
var _cql = qb.cql(); | ||
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql); | ||
}); | ||
it("should compile a simple 'count' query string", function () { | ||
@@ -522,0 +666,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144826
3241
816