nano-trivial
v1.3.0
Published
TrivialDB adapter for nanoSQL
Downloads
23
Maintainers
Readme
Nano-Trivial
Lets you use TrivialDB as a backend datastore for nanoSQL.
TrivialDB is a simple JSON file storage database. All changes are saved to disk as JSON files allowing you to easily view and edit database contents.
Documentation
Installation
npm i --save nano-trivial
Usage
import { nSQL } from "nano-sql";
import { TrivialAdapter } from "nano-trivial";
nSQL("table")
.model([...])
.config({
mode: new TrivialAdapter(),
...other config options
}).connect()...
That's it, now everything NanoSQL can do you can do with TrivialDB.
Read about NanoSQL here.
API
When you call new TrivialAdapter
there are two optional arguments, namespace arguments and database arguments.
The namespace arguments are documented here and mostly allow you to adjust the location the files are saved to.
The database arguments are documented here and allow you to do more advanced things like controlling wethere the JSON files are pretty printed or not.