# multistore

> MultiStore

Latest version **0.0.0** (published 2014-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install multistore
pnpm add multistore
yarn add multistore
bun add multistore
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2014-09-28 |
| First published | 2014-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Majid Arif Siddiqui |
| Maintainers | majidarif |

## Links

- npm: https://www.npmjs.com/package/multistore
- Repository: https://github.com/majimboo/node-multistore
- Issues: https://github.com/majimboo/node-multistore/issues
- npm.io page: https://npm.io/package/multistore

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [amqplib](https://npm.io/package/amqplib.md) ^0.2.1
- [bluebird](https://npm.io/package/bluebird.md) ^2.3.2
- [cassandra-driver](https://npm.io/package/cassandra-driver.md) ^1.0.0-beta1

## Recent versions

- 0.0.0 (latest) — 2014-09-28

## README

MultiStore [![Build Status](https://travis-ci.org/majimboo/node-multistore.svg?branch=master)](https://travis-ci.org/majimboo/node-multistore)
==========

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);

---
_Source: https://npm.io/package/multistore · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
