A file-based db system for prototyping in Node Projects
This module provides a simple file based database using folders as tables and files are rows/entries. It is created as a drop-in db system for your prototypes and small personal projects. That being said, I tried keeping the logic close to known DB systems so swapping it out should be relatively easy
Note that only full entries are returned. There's no such thing as selecting certain fields. DropDB is a class, and*////////////////////////////////// needs to be required and instantiated:
const dropdb = require('dropdb');
const db = new dropdb(options);
db.get(table, key);
The following object is the fallback object. By passing in an object in the constructor you can override them.
{
folder: 'db',
}
table: string
key: string
data: object
Returns a single entry by its table and key
Insert a new entry, cannot update exsisting entries
Update an entry, cannot insert new entries
Returns an array of entries, currently limited to one table.
The query
variable expects an object as following:
{
field: '', // Field name/key
compare: '', // Comparitive action
value: '' // Comparitive value
}
Exact match
Returns entries where the field isn't set or is set to undefined.
Returns entries where the value in the field is higher.
Returns entries where the value in the field is lower.