FANTASTIK
Fantastik is a easy to use, JSON-Type database that is made for ease of use and speed.
Fantastik also uses its own file extention .fan
designed to make JSON more intuitive for anyone involved with it.
Installation
Install simply with npm
npm install fantastik
cd my-project
Database İnitialization
to start using fantastik; require the package.
const { fandom } = require('fantastik')
after this you can create one or multiple databases
const { fandom } = require('fantastik')
const db1 = new fandom("myFile.fan")
const db2 = new fandom("myFile2.fan")
then; you can use very simple functions to use and interact with data on your database.
const { fandom } = require('fantastik')
const db = new fandom("myFile.fan")
//.write() is a function that writes data to the database.
db.set("cash", 100)
//.get() is a function that gets data that was previously written.
db.get("cash")
//.sum() will either add numbers or remove them
db.sum("cash", 20) // -> returns 120 (100+20)
db.sum("cash", -20 )// -> returns 80 (100 - 20)
//.has() will show wheter something exists in the storage
db.has("cash") //-> returns true
//.delete() will permamantly delete something from the storage
db.delete("cash")
//.push() will push an array/object to the database
db.push("myArray", [1,2,3,4,5])
//and lastly, .getAll() will return everything in the storage as an object.
db.getAll() //-> returns object of every item in the db
The .fan structure
the .fan file structure used to be a modified parser to JSON but now it has evolved into becoming just regular .bson. The .fan file structure is no longer its own thing and is now just a .bson file.
still we use the .fan extention to make it easier for people.