1.0.3 • Published 5 years ago

xqlite v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Xqlite

A simple NodeJS SQLite wrapper.

Installation

npm install xqlite --save

Usage

// Requiring the package
const Xqlite = require("xqlite");

// Initializing the database
const db = new Xqlite("name"); // Providing the name will create a persistent database. If you want non-persistent, don't pass the name.
const key = "any"; // any key that you want

// Set a default default value to the database!
// db.setDefault(key, { path: "value" })
db.setDefault(key, { string: "hello world", array: [], number: 1 });

// Set a new value
// db.set(key, path, value)
db.set(key, "string", "hello world 2");

// Push a value
// db.push(key, path, value)
db.push(key, "array", "an element of the array");

// Increase a value
// db.increment(key, path[, amount])
db.increment(key, "number");    // add 1
db.increment(key, "number", 2); // add 2

// Decrease a value
// db.decrement(key, path[, amount])
db.decrement(key, "number");    // subtract 1
db.decrement(key, "number", 2); // subtract 2

// Get a value from the database
// db.get(key[, path])
db.get(key);
db.get(key, "string");

// Delete a key, or path from the database
// db.delete(key[, path])
db.delete(key);
db.delete(key, "string");

// Returns an array of the database
// db.toArray()
db.toArray();

// Delete everything from the database
// db.deleteAll()
db.deleteAll();

// Create a backup of the database
// db.createBackup()
db.createBackup();

// Loads a backup of the database
// db.loadBackup(data)
db.loadBackup(db.createBackup().toString());

Support

Join our Discord server for support.

Developers

Extroonie (Ishmaam Khan) and Zytekaron (Michael).

Author

© Extroonie.
Authored and maintained by Extroonie (Ishmaam Khan).

GitHub @Extroonie

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago