0.5.3 • Published 3 years ago
@ashikuri/table-db v0.5.3
table-db
Tiny database interfacer 🐜
Install
$ npm i @ashikuri/table-db
or
$ yarn add @ashikuri/table-db
Usage
import TableApp from "@ashikuri/table-db"
import { JSONAdapter } from "@ashikuri/table-db/adapters"
async function application(){
const db = new TableApp("./database.json", JSONAdapter)
const users = await db.collection("users")
// return users
await users.insert({
id: 0,
name: "John Doe",
email: "john@doe.com",
online: true
}, {
id: 1,
name: "John Doe 2",
email: "john2@doe.com",
online: false
})
// ...
// note: Collection.save is an alias as db.save
await users.save() // or db.save() or db.write()
}
application()