Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
cql-client
Advanced tools
Node.js driver for cassandra on Cassandra Binary Protocol v2.
var client = require('cql-client').createClient({
hosts: ['127.0.0.1']
});
client.execute('SELECT * FROM system.peers', function(err, rs) {
var rows = rs.rows;
rows.forEach(function(row) {
console.log(row.peer);
console.log(row.host_id);
..
});
});
Install library
npm install cql-client --save
Create a client
var cql = require('cql-client');
var client = cql.createClient({ hosts: ['127.0.0.1'], keyspace: 'ks' });
Execute queries
client.execute('SELECT * FROM table', function(err, rs) {
rs.rows.forEach(function(row) {
console.log(row);
});
});
Execute prepared queries
client.execute(
'INSERT INTO table (id, v1, v2) VALUES (?, ?, ?)',
[1000, 'foo', 'bar'],
function(err) {
...
}
);
Batch
var batch = client.batch();
batch.add('UPDATE table SET v1 = ? WHERE id = ?', ['101', 1001]);
batch.add('UPDATE table SET v1 = ? WHERE id = ?', ['101', 1001]);
batch.add('DELETE FROM table WHERE id = ?', ['102']);
batch.commit(function(err) {
..
});
Read data with cursor
var cursor = client.execute('SELECT * FROM table', function(err, rs) {
var cursor = rs.cursor();
cursor.on('row', function(row) {
console.log(row);
});
cursor.on('error', function(err) {
..
});
cursor.on('end', function() {
console.log('done');
});
});
Create a client with options. The created client will connect the cluster automatically.
options
hosts
List of cassandra hosts you are connecting to. Use array to connect multiple hosts.keyspace
Name of the default keyspace.autoDetect
Set true to detect peers automatically. (Optional)connsPerHost
The size of connection pool per host. (Default: 2)connectTimeout
Milliseconds to determine connections are timed out. (Default: 5000)reconnectInterval
Milliseconds of interval for reconnecting. (Default: 5000)preparedCacheSize
Size of cache for prepared statement. (Default: 10000)Connect to the cluster. Note that you do not need to call the method since client will connect automatically.
cb
callback when connectedClose the connection to the cluster.
Get available connection from connections.
Execute CQL. It will use prepared query when values are specified.
query
Query statement to be executed.values
Array of bound values.options
consistencyLevel
Consistency level of the query. cql.CL.ONE,THREE,QUORUM,ALL,LOCAL_QUORUM,EACH_QUORUMpageSize
Paging size of the result.pagingState
Paging state of the query.serialConsistency
Serial consistency of the query.callback
Callback with error and result set.Create batch instance. See Batch.
Result data of the query.
Metadata of result rows and columns.
Array of rows.
Create cursor instance of the result.
Register event listener.
row
when cursor have an available rowend
when cursor endserror
when error occursAbort cursor. It will fire end
event.
Add query to the batch.
query
Query statement.values
Array of values to be bound.Set option parameters to the batch.
options
Same as options of client.execute()Commit queries. It will clean up queries in the batch after committing.
See LICENSE
Copyright (C) Suguru Namura
patched cql-protocol. See LICENSE and cql-protocol
FAQs
cassandra CQL driver uses Native Protocol v2
The npm package cql-client receives a total of 3 weekly downloads. As such, cql-client popularity was classified as not popular.
We found that cql-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.