Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

CesiumLabs/quick.db-prototypes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick.db Prototypes

Prototypes for quick.db.

Installation

$ npm i quick.db-prototypes

Example

const db = require("quick.db");
require("quick.db-prototypes")(db);

// access to db.startsWith
const data = db.startsWith("something", { sort: ".data" });
console.log(data);

Available Methods

db.startsWith(key, options?)

This method is identical to old db.startsWith() method. Example:

db.startsWith("something", { sort: ".data" });

db.deleteAll(key?, options?)

This method can be used to remove identical keys or entire table. Example:

db.deleteAll("someMatchingKey");

// or

db.deleteAll(); // delete entire table

db.pull(key, items | items[], options?)

This method can be used to remove items from array. Key must be a valid key and items can be a single or multiple (array). Example:

db.set("something", ["hello", "world", "hi", "hi", "ping"]);

db.pull("something", "hi"); // ["hello", "world", "ping"]
db.pull("something", ["hello", "world"]); // ["ping"]

db.setMany(items[], options?)

This method can be used to set multiple data at once. This method takes Array of data containing key and value pair as data. Example:

const data = [
    { key: "test_1", value: "hello1" },
    { key: "test_2", value: "hello2" },
    { key: "test_3", value: "hello3" },
    { key: "test_4", value: "hello4" },
    { key: "test_5", value: "hello5" },
    { key: "test_6", value: "hello6" },
    { key: "test_7", value: "hello7" },
    { key: "test_8", value: "hello8" },
    { key: "test_9", value: "hello9" }
];

db.setMany(data);

More features coming soon

Discord Server