0.0.12 • Published 9 years ago

jsonstorage v0.0.12

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

Relational JSON file storage for Node.js

====

This node.js package is intended as a replacement for a relational database for node.js. Relational databases like MySQL or SQlite often are ofter memory intensive and thus not suitable for embedded use (for instance on raspberry pi). Using JSON files for storage is much faster, only so far, no packages are available who introduce relations in json file storage. This package will change that.

Usage

// create a new instance of JsonStorage and link to a folder
var JsonStorage = require('JsonStorage');
var db = new JsonStorage(__dirname + '/dbfolder');

// create a new model (like a table)
db.create('myModel');

// get a model and create a new instance (like a row)
db.get('myModel').create(0, {name: "myRow"});

// get all instances of a model
db.get('myModel').all().then(function(response) {
	console.log(response);
});

// get a model and get an instance
db.get('myModel').get(0).then(function(response) {
	console.log(response);
});

// get a model and get an instance with it's one to one relations
db.get('myModel').get(0, ['mySecondModel']).then(function(response) {
	console.log(response);
});

// query a model
db.get('myModel').query('name', 'myRow').then(function(response) {
	console.log(response);
});

// get a model and delete an instance
db.get('myModel').delete(0);

Finished

  • Basic models and instances
  • Getting all instance
  • Get a single instance by ID
  • Query a model for instances (search by key)
  • Create, update and delete a model
  • Create, update and delete instances
  • One to one relationships

Todo:

  • Relationships one to many many to one, many to one * self referencing
  • Automatic create and update timestamps
  • Soft delete
  • Caching
0.0.12

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago