An in-memory data access layer for @rappopo/dab
npm install @rappopo/dab-memoryA Rappopo DAB implementation for in-memory datastore, powered by Lodash and lodash-query.
Simply invoke this command in your project folder:
```
$ npm install --save @rappopo/dab-memory
And within your script:
`javascript`
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) { ... })
Currently, no options necessary.
Data is internally saved as collections as follows:
`javascript`
dab.data.
{ _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
* [x] find
* [x] findOne
* [x] create
* [x] update
* [x] remove
* [x] bulkCreate
* [x] bulkUpdate
* [x] bulkRemove
* [x] copyFrom
* [x] copyTo
* [x] createCollection
* [x] renameCollection
* [x] removeCollection