0.5.0 • Published 3 years ago

node-productdb v0.5.0

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

Thx for use my Database!

This is a local database for writing and reading products for a discord bot or serves to store data such as: ID's of users among others.

const nodeproductdb = require("node-productdb");
const npdb = new nodeproductdb(); 
npdb.delete("reference/ref"); // delete the reference, please be careful!;
npdb.clear(); // delete the content of "productdb.json", please be careful!;
npdb.product("reference") // returns the product;
// for imports something:
npdb.product("reference/price") // returns the price of product;
npdb.product() // returns all products;
// others examples:
npdb.set("reference/ref", {
  price: 10,
  description: "descriptions here"
});
npdb.product("reference").map(product => {
  /* the parameter product returns the value as: {
    price: 10,
    description: "description here"
  }*/
  console.log(product.price, product.description);
}); // this maps the database and returns the value of reference;

// subtract and add examples:
npdb.subtract("reference/ref", 1); // if the value of ref is "0" this returns "-1";
npdb.add("reference/ref", 1); // if the value of ref is "0" this returns "1";

// get example:
var get = npdb.get("reference/ref"); // this returns the value of ref;
if(get == undefined) get = null; // the value of the variable can be any value;

// new method for use my database:
const npdb = new nodeproductdb("path", true); // if is false this will create the json file without the "products": {} and you can use npdb as normal database;

// set fix update:
npdb.set("reference/ref", {
  price: 10,
  description: "description here"
}) // all normal around here;
// before returned {"products": {"reference": {"ref": {"price": 10, description: "descriptions here"}}}} for now all right;
// now if you writes something else in the same reference happens it:
npdb.set("reference/ref", {
  id: 02
}) // this writes to the db file and returns like this: {"products": {"reference": {"ref": {"id": 02}}}};

// this has been fixed;

// keys added:
npdb.keys(); // returns the first reference;
npdb.keys("reference"); // returns "ref";

// new functions added: 
npdb.find("reference", "ref"); // returns the value of "ref";
npdb.values("reference"); // returns the value of "reference";
  • Added keys, find and values functions;
  • Added a wait time to solve problems with lag;
  • Updated the system of set, now he writes correctly! examples above!;
  • Fixed set issue;
  • New method for use the database;
  • Warning: If you have any problems please send me a message on my Discord!

Discord in my profile of npm, Click Here!

0.4.1-fix

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.2-fix

3 years ago

0.3.1-fix

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.7

3 years ago

0.2.1-fix

3 years ago

0.2.1-fixed

3 years ago

0.2.2

3 years ago

0.2.5

3 years ago

0.2.1

3 years ago

0.1.2

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago