1.0.0 • Published 3 years ago
quick-mariadb v1.0.0
quick-mariadb
What it is?
This npm module comes with new age of mariadb, which makes it easier and familier to use.
How I can use it?
It is simple. First of all, you must define an options:
const db = require("quick-mariadb");
var options = {
host: "ip_address",
user: "username",
password: "password",
database: "database",
port: port
And more you can find in mariadb's documentation
Then you just use set or get method.
async function get(options) {
const getted = await db.get(options, "table_name", "key");
return getted;
}
async function set(options) {
const setted = await db.set(options, "table_name", "key", "value");
return setted;
}
If you want to push into array, just create a push function:
async function push(options, array, element) {
array.push(element);
const setted = await db.set(options, "table_name", "key", array);
return setted;
}
© Šebestíček | Working with 🧄Garlic Team
1.0.0
3 years ago