0.0.1 • Published 3 years ago

@mustqfq/apex v0.0.1

Weekly downloads
5
License
Apache-2.0
Repository
-
Last release
3 years ago

apex.db® | JSON Database

Developer: Swôth#9990   DataBase Types: JSON (Cloud database is coming soon, like mongo.db)

 

Usage

const Apex = require('@mustqfq/apex'); // creating database
const db = new Apex({
  file: 'database.json',
  readable: 'true',
  language: 'EN'
}); // languages: TR and EN

/* -------------------------------------- */

db.import(require('quick.db'));
/* 
  EN: quick.db datas to apex.db
  TR: quick.db'deki verileri apex.db'ye aktarır.
  (logs to console)
*/

/* -------------------------------------- */

setInterval(() => db.backup(), 600000);
/* 
  backups every 10 mins
*/

/* -------------------------------------- */

db.set('users.swoth.money', 100);
/* 
  reponse: true
*/

/* -------------------------------------- */

db.get('users.swoth.money');
db.fetch('users.swoth.money');
/* 
  response: 100
*/

/* -------------------------------------- */

db.has('users.swoth.money');
/*
  response: true
*/
db.has('users.swoth.username');
/*
  response: null
*/

/* -------------------------------------- */

db.delete('users.swoth.money');
/*
  response: true
*/

/* -------------------------------------- */

db.add('users.swoth.money', 100);
/*
  response: true
  value: 100
*/
db.add('users.swoth.money', -60);
/*
  response: true
  value: 40
*/

/* -------------------------------------- */

db.push('admins', 'Swoth');
/*
  response: true
  value: ['Swoth']
*/
db.pull('admins', 'Swoth'); // unpush
/*
  response: true
  value: []
*/

/* -------------------------------------- */

db.all();
/*
  response:
  {
    "users": {
      "swoth": { 
        "money": 40 
      } 
    },
    "admins": []
  }
*/

/* -------------------------------------- */

db.deleteAll();
/*
  response: true
*/

   

by Swôth#9990 (Apache-2.0)