DragonDev15 / Xen.db

A SQLite Database. Easy-To-Use Package For Beginners.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xen.db

downloadsBadge versionBadge

Xen.db Is An Open-Sourced Database Package Designed To Be Easy-To-Use & Friendly For Beginners. This Package Meant To Provide Easy Way For Users To Access & Store Various Data Persistently In A Database Via BetterSQLite3.

  • Powerful - Supports Non-Xen.db API.
  • Customizable - More Utility Method.
  • Family-Friendly - Simple & Easy-To-Use For Beginners.
  • 100% Based - Key Value Based.
  • Persistent Database - Value Will Not Lost When On Retstarting Session.
  • Free-To-Use - Not Needed To Set Up A SQL Database Server! All Data Is Stored Locally In The Same Project.
  • Best Friends - Supports Your Existing Quick.db json.sqlite Database.
  • Free Vehicles - Easily Switch/Migrate Library Between Xen.db & Quick.db Library If You're Using json.sqlite File As Database.
  • Work Together - Support Various Of Supported Library Such As Above.

V2.0.0 Updates:

  • Added New Method - (method) Database.fetchOne() Alias: (method) Database.getOne()
  • (method) Database.fetchOne() - Fetch A Specific Value(s) From The Database Key.
  • Repaired - Fixed Minor Bugs

Example

Coding A Sandbox (Demo)

const { Database } = require("xen.db") 
const db = new Database() 

// Setting an object in the database:
db.set('userInfo', { difficulty: 'Easy' })
// -> { difficulty: 'Easy' }
 
// Pushing an element to an array (that doesn't exist yet) in an object:
db.push('userInfo.items', 'Sword')
// -> { difficulty: 'Easy', items: ['Sword'] }
 
// Adding to a number (that doesn't exist yet) in an object:
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword'], balance: 500 }
 
// Repeating previous examples:
db.push('userInfo.items', 'Watch')
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 500 }
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 1000 }
 
// Fetching individual properties
db.get('userInfo.balance') // -> 1000
db.get('userInfo.items') // ['Sword', 'Watch']

Creating A Table

const table = db.createTable("MyTable")

db.set("Inv", "Sword")
table.set("Inv", 123)

db.get("Inv") // Returns "Sword"
table.get("Inv") // Returns "123"

List All Tables

const tables = db.tables()

console.log(tables)

Installation

If you're having some troubles installing this, please follow this Troubleshooting Guide.

Linux & Windows Platform
  • npm i xen.db

Note: Windows platform users might need to do additional steps Here.

Mac Platform
  1. Install: XCode
  2. Run: npm i -g node-gyp in your console/terminal
  3. Run: node-gyp --python /path/to/python2.7 (Skip this step if you didn't install Python 3.x)
  4. Finally, Run: npm i xen.db

Documentation

  • Soon!

About

A SQLite Database. Easy-To-Use Package For Beginners.

License:MIT License


Languages

Language:JavaScript 100.0%