mmreql

1.0.1 • Public • Published

logo

mmreql provides a mock rethinkdb-ts for tests and offline development

import mmreql from 'mmreql'

const { r } = mmreql([
  ['Users',
    { id: 'userId-1234', name: 'fred' },
    { id: 'userId-5678', name: 'jane' }],
  ['Rooms', [{ primaryKey: 'room_id' }],
    { room_id: 'roomId-1234', name: 'the room' }],
  ['Memberships', {
    user_id: 'userId-1234',
    room_membership_type: 'INVITE',
    user_sender_id: 'userId-5678',
    room_id: 'roomId-1234'
  }]
])

await r.table('Memberships').indexCreate('user_id').run()

console.log(await r
 .table('Memberships')
 .getAll('userId-1234', { index: 'user_id' })
 .eqJoin('room_id', r.table('Rooms'))('right')
 .run())
// { room_id: 'roomId-1234', name: 'the room' }

A mock-rethinkdb-ts database package for javascript environments

  • support for complex and nested queries,
  • support for creating, updating, deleting and specifying many databases,
  • support for changefeeds,
  • optionally initialized with plain object-literal data,
  • copies and re-uses tests from rethinkdb-ts,
  • supports atomic row update and replace queries,
  • zero dependencies

This mock database was developed around various services to cover a wide range of use-cases. See unit-tests for more detailed examples. Feel free to open an issue or send an email for any other questions.

Package Sidebar

Install

npm i mmreql

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

571 kB

Total Files

29

Last publish

Collaborators

  • bumblehead