0.5.7 • Published 4 years ago

jsonotron-memdocstore v0.5.7

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

An in-memory document store for Jsonotron

npm.io npm JavaScript Style Guide

An in-memory JSON document store that implements the Jsonotron document store interface.

This package is aimed at testing scenarios because the documents upserted and deleted from the collection are not stored permanently.

This package is part of the Jsonotron system.

Jsonotron is...

  • a small set of components for building a NodeJS microservice
  • for storing, patching and querying JSON documents
  • stored in a schemaless/NoSQL database
  • that have known, enforceable, and evolving schemas.

Visit https://karlhulme.github.io/jsonotron/ for details on how to get started.

Installation

npm install jsonotron-memdocstore --save

Usage

To instantiate a MemDocStore you have to provide 2 parameters:

  • docs - An array of "documents". Each document is just a POJO.

  • docVersionGenerator - A function (doc) that returns a unique version number string given a document. This can be a hash based on the given document or just a unique number. Simplest method is to pass it the uuid/v4 library as this will generate a UUID.

const { createMemDocStore } = require('jsonotron-memdocstore')
const uuid = require('uuid/v4')

const docs = []
const memDocStore = createMemDocStore(docs, uuid)

memDocStore.upsert('test', {
  id: '0001',
  docType: 'test',
  hello: 'world'
})

Development

Code base adheres to the rules chosen by https://standardjs.com/. Code is formatted with 2 spaces.

Tests are written using Jest with 100% coverage.

npm test

Continuous Deployment

Any commits to master will cause the library to be re-published.

0.5.7

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago