New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dl-nosqldb

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dl-nosqldb

DL nosqldb library

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
2
Weekly downloads
 
Created
Source

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"]
           }
       }
   ]);

Keywords

FAQs

Package last updated on 04 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc