Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cassanknex

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cassanknex - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

22

index.js

@@ -100,2 +100,24 @@ /**

// create the eachRow function for a pass through to the datastax driver
qb.eachRow = function (rowCb, errorCb) {
if (!_.isFunction(rowCb)) {
rowCb = _.noop;
}
if (!_.isFunction(errorCb)) {
errorCb = _.noop;
}
if (cassandra !== null && cassandra.connected) {
var cql = qb.cql();
cassandra.eachRow(cql, qb.bindings(), rowCb, errorCb);
}
else {
errorCb(new Error("Cassandra client is not initialized."));
}
// maintain chain
return qb;
};
return qb;

@@ -102,0 +124,0 @@ }

2

package.json
{
"name": "cassanknex",
"version": "1.2.0",
"version": "1.3.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",

@@ -8,3 +8,3 @@

An Apache Cassandra CQL query builder with support for the DataStax NodeJS driver, written in the spirit of [Knex](knexjs.org) for [CQL 3.1.x][cassandra-cql-3_1-ref-url].
An Apache Cassandra CQL query builder with support for the DataStax NodeJS driver, written in the spirit of [Knex][knexjs-url] for [CQL 3.1.x][cassandra-cql-3_1-ref-url].

@@ -59,4 +59,4 @@ ## Index

Execution of a given query is performed by invoking either the `exec` or `stream` methods
(which are straight pass throughs to the DataStax driver's `execute` and `stream` [methods][cassandra-driver-docs-url], respectively).
Execution of a given query is performed by invoking either the `exec`, `stream` or `eachRow` methods
(which are straight pass throughs to the DataStax driver's `execute`, `stream` and `eachRow` [methods][cassandra-driver-docs-url], respectively).

@@ -84,2 +84,3 @@ ```js

// pass through to the underlying DataStax nodejs-driver 'execute' method
qb.exec(function(err, res) {

@@ -89,3 +90,4 @@ // do something w/ your query response

// or pass through to the underlying DataStax nodejs-driver 'stream' method
// OR pass through to the underlying DataStax nodejs-driver 'stream' method
var onReadable = function () {

@@ -114,2 +116,17 @@ // Readable is emitted as soon a row is received and parsed

});
// OR pass through to the underlying DataStax nodejs-driver 'eachRow' method
var rowCallback = function (n, row) {
// The callback will be invoked per each row as soon as they are received
console.log(row);
// do something w/ the row response
}
, errorCb = function (err) {
// Something went wrong: err is a response error from Cassandra
console.log("query error", err);
};
// Invoke the eachRow method
qb.eachRow(rowCallback, errorCb);
});

@@ -304,2 +321,4 @@ ```

- 1.3.0
- Add support for the DataStax driver `eachRow` method.
- 1.2.0

@@ -321,1 +340,2 @@ - Add support for the DataStax driver `stream` method.

[cassandra-driver-docs-url]: http://docs.datastax.com/en/drivers/nodejs/2.1/Client.html
[knexjs-url]: http://knexjs.org/

@@ -43,3 +43,3 @@ /**

"build a sample table and execute several insertions into that table, " +
"and read records inserted using both the 'exec' and 'stream' methods.", function (done) {
"and read records inserted using both the 'exec' and 'stream' and 'eachRow' methods.", function (done) {

@@ -132,2 +132,22 @@ this.timeout(0);

});
},
// test the eachRow method
function (next) {
var rowCallback = function (n, row) {
// Readable is emitted as soon a row is received and parsed
assert(_.has(row, "id"), "Response must contain the id.");
}
, errorCb = function (err) {
// Something went wrong: err is a response error from Cassandra
assert(!err, "query error", err);
next(err);
};
var qb = cassanKnex(keyspace)
.select()
.from(columnFamily);
// Invoke the eachRow method
qb.eachRow(rowCallback, errorCb);
}

@@ -134,0 +154,0 @@ ], function (err) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc