Prototypes for quick.db.
$ npm i quick.db-prototypes
const db = require("quick.db");
require("quick.db-prototypes")(db);
// access to db.startsWith
const data = db.startsWith("something", { sort: ".data" });
console.log(data);
This method is identical to old db.startsWith()
method.
Example:
db.startsWith("something", { sort: ".data" });
This method can be used to remove identical keys or entire table. Example:
db.deleteAll("someMatchingKey");
// or
db.deleteAll(); // delete entire table
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"]
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);