0.1.7 • Published 8 years ago

rijs.db v0.1.7

Weekly downloads
21
License
pemrouz.mit-licen...
Repository
github
Last release
8 years ago

Ripple | Database

Coverage Status Build Status

Allows connecting a node to external services. For example, when a resource changes, it could update a database, synchronise with other instances over AMQP, or pump to Redis.

ripple = require('rijs')({ db: 'type://user:password@host:port/database' })

It destructures the connection string into an object, looks up the type in ripple.adaptors, then passes that function the connection string as an object, and stores the result under ripple.connections.

ripple.connections.push(
  ripple.adaptors[type]({ type, user, database, port, host, password })
)

You must register any adaptors you wish to use separate to this module. An adaptor is a constructor function that takes the connection string as an object, creates an active connection and returns an object of functions for each possible change type: { add, update, remove }. These hooks will be invoked when the corresponding event occurs.

ripple.on('change', ({ key, value, type }) => 
  ripple.connections.map(con => 
    con[type](res, key, value)))
0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago