Package Exports
- rijs.db
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rijs.db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Ripple | Database
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)))