Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fed135/scylla-driver
Node.js Driver for the scylla databse engine [WIP]
https://github.com/fed135/scylla-driver
cassandra cql database driver hacktoberfest nosql scylla scylladb
Last synced: about 2 months ago
JSON representation
Node.js Driver for the scylla databse engine [WIP]
- Host: GitHub
- URL: https://github.com/fed135/scylla-driver
- Owner: fed135
- License: other
- Created: 2017-07-27T07:00:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T18:50:47.000Z (7 months ago)
- Last Synced: 2024-05-16T19:48:52.870Z (7 months ago)
- Topics: cassandra, cql, database, driver, hacktoberfest, nosql, scylla, scylladb
- Language: JavaScript
- Homepage:
- Size: 330 KB
- Stars: 3
- Watchers: 7
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScyllaDB Node.js Driver
# Work in progress - do not use!
[![ScyllaDB](https://img.shields.io/npm/v/scylladb.svg)](https://www.npmjs.com/package/scylladb)
[![Node](https://img.shields.io/badge/node->%3D4.0-blue.svg)](https://nodejs.org)
[![Build Status](https://travis-ci.org/fed135/scylladb.svg?branch=master)](https://travis-ci.org/fed135/scylladb)---
**Disclaimer** I am not associated in any way with [ScyllaDB](https://github.com/scylladb) or [Datastax](https://github.com/datastax).
Just a guy in need of a good solution to his problems.Loosely based on the current [datastax cassandra driver](https://github.com/datastax/nodejs-driver), it focuses on performance and a cleaner interface.
---
## Install
```bash
$ npm install scylladb
```## Usage
### Connecting
Creating a client will spawn multiple forks to allow for more paralel work.
```javascript
const scylladb = require('scylladb');
const client = scylladb.createClient({
hosts: ['0.0.0.0', '0.0.0.1'],
keyspace: 'ks1'
});
```**Options**
Fields | Description
--- | ---
hosts | List of hosts to connect to. Can be an IP, a fqdn or a unix socket (required)
keyspace | The keyspace to select (required)
workers | The number of connection workers to spawn per host (default: 10)### Querying
Querying has been streamlined to now only return a Promise or a Stream.
```javascript
client.execute('SELECT name, email FROM users WHERE key = ?', [ 'someone' ], { prepare: true })
.then(result => console.log(`User with email ${result.rows[0].email}`));
```### Row streaming
It can be **piped** downstream and provides automatic pause/resume logic (it buffers when not read).
```javascript
client.stream('SELECT time, val FROM temperature WHERE station_id=', [ 'abc' ])
.on('readable', (rows) {
rows.forEach(row => console.log(`time ${row.time} and value ${row.value}`));
})
.on('end', () => console.log('stream ended'));
.on('error', err => console.log(`Error: ${err}`));
```## Logging
ScyllaDB driver uses [debug](https://github.com/visionmedia/debug)
```
DEBUG=scylladb:*
```The `level` being passed to debug can be `verbose`, `info`, `warning` or `error`.
## Contribute
I am always looking for maintainers. Reach out to me to get involved.
## Tests
### Requirements
Once you have a database setup with a keyspace named "test" and a table "users".
Help can be found in the [wiki](https://github.com/fed135/scylla-driver/wiki).### Usage
Tests can be run with:```bash
npm run test
```## License
[Apache 2.0](LICENSE) (c) 2017 Frederic Charette