New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

multistore

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multistore

MultiStore

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

MultiStore Build Status

Simple Node.JS O[R/D]M.

Example

var Store = require('multistore');

// ordering gives priority. In this configuration cassandra
// is the highest priority. If cassandra fails, the lower
// priorities does not execute.
var store = new Store({
  cassandra: {
    contacts: ['localhost'],
    keyspace: 'medintegrate'
  },
  amqp: {
    host: 'amqp://localhost'
  }
});

// load all adapters
store.init(done_callback);

// define a schema
store.schema('transaction_logs', {
  channel_id:       { type: 'text',     required: true },
  date:             { type: 'text',     required: true },
  event_id:         { type: 'timeuuid', required: true },
  transaction_id:   { type: 'uuid',     required: true },
  source_system_id: { type: 'text',     required: true },
  target_system_id: { type: 'text',     required: true },
  subject_id:       { type: 'text',     required: true },
  sender_id:        { type: 'text',     required: true },
  recipient_id:     { type: 'text',     required: true },
  data_id:          { type: 'text',     required: true },
  event_status:     { type: 'text',     required: true }
});

// if a required field is missing it throws an error
var transaction = {
  channel_id:       chance.word(),
  date:             chance.date({string: true}),
  event_id:         cassandra.types.timeuuid(),
  transaction_id:   cassandra.types.uuid(),
  source_system_id: chance.word(),
  target_system_id: chance.word(),
  subject_id:       chance.word(),
  sender_id:        chance.word(),
  recipient_id:     chance.word(),
  data_id:          chance.word(),
  event_status:     chance.word(),
  i_get_ignored:   'because I am not defined in store.schema()' // wont be inserted
}

// insert to all active adapters
// in this case: cassandra then amqp
store.insert('transaction_logs', transaction, done_callback);

// insert to specific adapter
// if 2nd argument is an array, it gets inserted in batch
// if its an object it gets inserted with execute prepared.
store.cassandra.insert('transaction_logs', transaction, done_callback);

FAQs

Package last updated on 28 Sep 2014

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