@rappopo/dab-memory

0.6.11 • Public • Published

@rappopo/dab-memory

A Rappopo DAB implementation for in-memory datastore, powered by Lodash and lodash-query.

Installation

Simply invoke this command in your project folder:

$ npm install --save @rappopo/dab-memory

And within your script:

const DabMemory = require('@rappopo/dab-memory')
const dab = new DabMemory()
// prepare collections
dab.createCollection({ name: 'test' })
  .then(result => {
    return dab.bulkCreate(data, { collection: 'test' })
  })
...
// lets dab!
dab.findOne('my-doc', 'test').then(function(doc) { ... })

Options

Currently, no options necessary.

Features

Data is internally saved as collections as follows:

dab.data.<collection-name> = [
  { _id: "key1", name: "name1", ... },
  { _id: "key2", name: "name2", ... }
]

To enforce structured data throughout DAB and use features provided by collections, you need to createCollection () with your custom fields as explained here

Donation

  • Donate
  • Bitcoin 16HVCkdaNMvw3YdBYGHbtt3K5bmpRmH74Y

License

MIT

Package Sidebar

Install

npm i @rappopo/dab-memory

Weekly Downloads

9

Version

0.6.11

License

MIT

Unpacked Size

55.5 kB

Total Files

22

Last publish

Collaborators

  • rappopo