cassandra-helper
v1.0.5
Published
Cassandra util functions
Downloads
7
Maintainers
Readme
cassandra-helper
Cassandra helper functions which will make your code easier to fetch and write data to database. This library supports CQL transactions in a cleaner way. Its a wrapper upon cassandra-driver.
Install
npm i --save cassandra-helper
Usage
const cassUtils = require('cassandra-helper');
const config = {
contactPoints: ['h1', 'h2'],
localDataCenter: 'datacenter1',
keyspace: 'ks1'
};
// A generic callback which contains three parameters [err, data, msg]
const callback = (err, data, msg) {
console.log({err, data, msg})
}
const query = "SELECT * FROM table1 WHERE id = ? AND name = ?" // sample query
const params = [1, 'name_1']; // sample parameter for above query
cassUtils.creatConnection(config);
cassUtils.queryReturn(query, params, callback, 'Fetch success message', 'Fetch failure message');
License
ISC © hanjas