npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dl-nosqldb

v1.0.0

Published

DL nosqldb library

Downloads

7

Readme

dl-nosqldb

The library dl-nosqldb allows to connect with Cassandra database and manage data.

Install

npm install dl-nosqldb

const NoSqlDb = require(dl-nosqldb);

API

http://doc.grupa.onet/display/NOS/API+Reference

This library is compatible with callback and promise invoke. Below there are examples of usage:

➦ **Example of usage with promise **

'use strict';

const Nosqldb = require('dl-nosqldb').Nosqldb;

const nosqldb = new Nosqldb(datasource);
let key = [namespaId];
let colValues = {
    name: 'nosql',
    deleted: false
};

nosqldb.insert(table, key, colValues)
    .then((data) => {
        return callback(null, data);
    })
    .catch((err) =>{
        return callback(err);
    });

➦ **Example of useage with callback **

'use strict';

const Nosqldb = require('dl-nosqldb').Nosqldb;

const nosqldb = new Nosqldb(datasource);
let key = [namespaId];
let colValues = {
    name: 'nosql',
    deleted: false
};

nosqldb.insert(table, key, colValues, {}, callback);

Available methods

get (table, key[, options = {}, cb = null]) {

return data by key

options:
  • columns
  • consistency
example:
   nosqldb.get('table_name', ['col_1_value', 'col_1_value'])

getRange (table, keyPrefix, options = {}, cb = null)

return data by part of key

options:
  • rangeLt
  • rangeLte
  • rangeGt
  • rangeGte
  • columns
  • orderBy
  • limit
  • consistency
example:
   nosqldb.getRange('table_name', ['col_1_value']')

multiGet (items, options = {}, cb = null)

return data from many get query, optionaly limitation to the values of defined columns

options:
  • consistency
example:
   nosqldb.multiGet([
        {
            "table": "table_name",
            "key":  ['col_1_value', 'col_2_value']
        },
        {
            "table": "table_name2",
            "key":  ['col_1_value2', 'col_2_value2']
        }
    ]);
   nosqldb.multiGet([
        {
            "table": "table_name",
            "key":  ['col_1_value', 'col_2_value'],
            "columns": ["col_2", "col_3", "col_4"]
        },
        {
            "table": "table_name2",
            "key":  ['col_1_value2', 'col_2_value2'],
            "columns": ["col_2", "col_3", "col_4"]
        }
    ]);

insert (table, key, columns, options = {}, cb = null)

added new element

options:
  • ttl
  • consistency
example:
   nosqldb.insert("table_name", ['col_1_value', 'col_2_value'], { "col_3": "test", "col_4": "test" });
   nosqldb.insert("table_name", ['col_1_value', 'col_2_value'], { "col_3": "test", "col_4": "test" }, {"ttl": 200});

multiInsert (items, options = {}, cb = null)

added new elements in one query

options:
  • consistency
example:
    nosqldb.multiInsert( [ 
        {
            "table": "table_name",
            "key": ['col_1_value', 'col_2_value'],
            "columns": { "col_3": "test", "col_4": "test" }
        },
        {
            "table": "table_name",
            "key": ['col_1_value2', 'col_2_value2'],
            "columns": { "col_3": "test", "col_4": "test" },
            "ttl": 200
        }
    ]);

update (table, key, assignments, options = {}, cb = null)

update data by key

options:
  • ttl
  • consistency
example:
   nosqldb.update("table_name", ['col_1_value', 'col_2_value'], { "col_3": [ "=", "testnew"]});

remove (table, key, options = {}, cb = null)

remove data by key

options:
  • columns
  • consistency
example:
   nosqldb.remove("table_name", ['col_1_value', 'col_2_value']);

batch (operations, options = {}, cb = null)

execute list of operations (insert or remove only)

options:
  • consistency
example:
   nosqldb.batch([
       {
           "name": "insert",
           "params": {
                "table": "table_name",
                "key": ["col_1_value", "col_2_value"],
                "columns": { "col_3": "test", "col_4": "test" },
                "ttl": 200
           }
       },
       {
           "name": "insert",
           "params": {
                "table": "table_name",
                "key": ["col_1_value2", "col_2_value2"],
                "columns": { "col_3": "test", "col_4": "test" }
           }
       },
       {
           "name": "remove
           "params": {
                "table": "table_name",
                "key": ["col_1_value", "col_2_value"]
           }
       }
   ]);