1.0.2 • Published 3 years ago
pokerdb v1.0.2
what is pokerdb ?
- pokerdb is a library stored as a json file
Benefit
- You can use it in small projects or tests without a database server
- Library size is very light
- Query and modify data using plain JS
- Simple API easy to learn
Warning
If you are using nodemon. please create nodemon.json file and add this attribute as it is necessary
{
"ignore": ["pokerdb/*"]
}
Install
npm install pokerdb
Usage
// Require
var db = require("pokerdb")
// Query to 1 table
var user = db.table("user")
// Add data to the table
user.add({
name: "Poker",
age: 19
})
// Do not add the "id" attribute as it will be added automatically
// Get all data in 1 table
user.all().then(data => console.log(data))
// Get data on 1 row
user.row({ id: 1}).then(data => console.log(data))
// Edit data on 1 row
user.edit({ id: 1},{
name: "John"
})
// Delete data on 1 row
user.del({id : 1})
// Delete Table
user.delete
Support Async/Await
(async () => {
var data = await user.all()
var data = await user.row({id: 1})
console.log(data)
})