json-easy-db
v1.0.3
Published
json-easy-db is a easy to use json database
Downloads
2
Readme
How To Use Database
String/Text
creating database
//this code will create a new database
//you can have more then one database
const Database = require("json-easy-db");
const db = new Database("./db.json")
setting data in database
//this code will set a value in database
//the name and value can be anything
db.setDB("name","value")
for getting the data in database
//this code will get the date of name in database
db.getDB("name")
//you can use
db.getAllDB()
//for getting all the database (it will return a object like this {value:"name"})
deleting a data from database
//this code will delete a data from database
//the name can be anything
db.deleteDB("name")
//you can use
db.ClearDB()
//for deletting every stuff in database
subtract and add from database
//this code subtract and add a value in database
db.setDB("money",10)
db.addDB("money",20)
//this will make money value be 30
db.subtractDB("money",20)
//this will remove 20 from money
//it will make money value be 10
exist in database
//this code will see if a db exist
if(db.existDB("name")){
//db exist
}else{
//db dont exist
}
Objects
setting in object
//this code will create and set a value in the database as a object {}
//there is 2 way for doing it
//way 1
db.setDB("name",{})
db.setInObject("name","key name","value")
//way 2
db.setInObject("name","key name","value")
getting in object
//this code will get a value in a object {}
//there is 2 way for doing it
//way 1
db.getDB("name").keyname
//way 2
db.getInObject("name","key name")
deleting a value in object
//this code will delete a value in a object {}
db.deleteInObject("name","key name")
exist in object
//this code will see if a object {} exist in a db
if(db.existInObject("name")){
//value exist
}else{
//value dont exist
}