Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jameskyburz/rwait
wait for rethinkdb mutations
https://github.com/jameskyburz/rwait
javascript rethinkdb
Last synced: 16 days ago
JSON representation
wait for rethinkdb mutations
- Host: GitHub
- URL: https://github.com/jameskyburz/rwait
- Owner: JamesKyburz
- License: apache-2.0
- Created: 2017-09-17T12:39:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-08T11:52:32.000Z (almost 6 years ago)
- Last Synced: 2024-12-02T02:41:27.629Z (about 1 month ago)
- Topics: javascript, rethinkdb
- Language: JavaScript
- Homepage: https://npm.im/rwait
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rwait
[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/feross/standard)
[![npm](https://img.shields.io/npm/v/rwait.svg)](https://npmjs.org/package/rwait)
[![downloads](https://img.shields.io/npm/dm/rwait.svg)](https://npmjs.org/package/rwait)## Usage
```js
const r = require('rethinkdbdash')({ host: 'localhost' })
const rwait = require('rwait')(r);(async () => {
try {
const pending = await rwait({
db: 'test',
table: 'test',
timeout: 2000,
filter: r.row('new_val')('id').eq('test')
})// some operation that causes a write somewhere else....
process.nextTick(() => {
r.db('test').table('test').insert([ { id: 'test', value: 'hello world' } ]).run()
})const value = await pending.value
console.log('got value', value)
} catch (err) {
console.error('error', err)
}
})()
```# license
[Apache License, Version 2.0](LICENSE)