QDB is a high level data management package which you can import for storing local JavaScript Objects without corruptions. You may connect to multiple JSON files, apart or in a pool, edit data
directly or use built-in functions, use polling for multi-process data access and create backups of your databases*.
process.on("QDB-Debug", n => console.log(n));
const QDB = require("qdatabase");
const MyDB = new QDB.Connection("./Databases/Users.json", {
Polling: 3000 });
// Append an object into the 'Users' database.
MyDB.Append({User: "Smally", Job: "Software Engineer"});
Use the JavaScript Maps with extended utility methods named 'Collections', slightly modified from the Discord.js repository. Use Cache Collections to quickly create lists of data, or use DataStores to create and resolve data models efficiently.
Cache
Collection with extended custom caching features. Use Caches to easily make lists with automatic ID tracking, an accumulator tracking value and cached values for optimisation.
const Cache = new QDB.Cache();
Cache.set(
// Insert data under iterate ID
Cache.id,
Values[i]
);
DataStore
Base class that manages the creation, retrieval and deletion of a specific data model. DataStores allows you to manage specific data models, optimise the retrieval and extend the class.
const DataStore = new QDB.DataStore();
DataStore.set("b0ce7d", {Name: "Smally", Job: "Software Engineer"});
// Resolve a data model or retrieve the Last Recently Resolved.
DataStore.resolve("b0ce7d");
DataStore.LRR;
Manager
Manages the API methods of DataModels and holds its cache. An extendable base class which allows you to implement a manager for each data structure you have to interact with it.
class UserManager extends BaseManager {
constructor (Client, ...Args) { super(...Args); this.Client = Client; }
get Administrators () { // Returns all the administrators in this Manager
return this.Cache.filter(User => User.Administrator);
}
}
* backups of pools can only be created on Unix-running machines