1.0.5 • Published 3 years ago

cassandra-helper v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

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.

NPM JavaScript Style Guide

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

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago