项目作者: JamesKyburz

项目描述 :
wait for rethinkdb mutations
高级语言: JavaScript
项目地址: git://github.com/JamesKyburz/rwait.git
创建时间: 2017-09-17T12:39:24Z
项目社区:https://github.com/JamesKyburz/rwait

开源协议:Apache License 2.0

下载


rwait

js-standard-style
npm
downloads

Usage

  1. const r = require('rethinkdbdash')({ host: 'localhost' })
  2. const rwait = require('rwait')(r)
  3. ;(async () => {
  4. try {
  5. const pending = await rwait({
  6. db: 'test',
  7. table: 'test',
  8. timeout: 2000,
  9. filter: r.row('new_val')('id').eq('test')
  10. })
  11. // some operation that causes a write somewhere else....
  12. process.nextTick(() => {
  13. r.db('test').table('test').insert([ { id: 'test', value: 'hello world' } ]).run()
  14. })
  15. const value = await pending.value
  16. console.log('got value', value)
  17. } catch (err) {
  18. console.error('error', err)
  19. }
  20. })()

license

Apache License, Version 2.0