electus-db
v5.0.1
Published
✨ JSON, MongoDb, YAML, SQL Veri Tabanlı Database Modülü.
Downloads
22
Maintainers
Readme
Yüklemek İçin
npm install electus-db
Yeni Özellikler
Json, Sql, Yaml, Desteği Getirildi
Nasıl Kullanılır? 💫
JS Sql
const Database = require("../lib/index");
const db = new Database.Sql();
// Set data
db.set("Hello", "World");
// Get data
db.get("Hello"); // World
db.fetch("Hello"); // World
// Delete data
db.delete("Hello");
db.get("Hello"); // undefined
db.has("Hello"); // false
db.set("age", 10);
db.add("age", 1); // 11
db.subtract("age", 9); // 2
db.set("array", [ "apple" ]);
db.push("array", "orange"); // [ "apple", "orange" ]
// Clear data
db.deleteAll();
// Get all the data
db.all();
JS Mongo
const Database = require("../lib/index");
const db = new Database.Mongo("mongodb://localhost/electusdb");
async function hello() {
// Set data
await db.set("Hello", "World");
// Get data
await db.get("Hello"); // World
await db.fetch("Hello"); // World
// Delete data
await db.delete("Hello");
await db.get("Hello"); // undefined
await db.has("Hello"); // false
await db.set("age", 10);
await db.add("age", 1); // 11
await db.subtract("age", 9); // 2
await db.set("array", [ "apple" ]);
await db.push("array", "orange"); // [ "apple", "orange" ]
// Clear data
await db.deleteAll();
// Get all the data
await db.all();
};
hello();
JS Yaml
const Database = require("../lib/index");
const db = new Database.Yaml();
// Set data
db.set("Hello", "World");
// Get data
db.get("Hello"); // World
db.fetch("Hello"); // World
// Delete data
db.delete("Hello");
db.get("Hello"); // undefined
db.has("Hello"); // false
db.set("age", 10);
db.add("age", 1); // 11
db.subtract("age", 9); // 2
db.set("array", [ "apple" ]);
db.push("array", "orange"); // [ "apple", "orange" ]
// Clear data
db.deleteAll();
// Get all the data
db.all();
JS Json
const Database = require("../lib/index");
const db = new Database.Json();
// Set data
db.set("Hello", "World");
// Get data
db.get("Hello"); // World
db.fetch("Hello"); // World
// Delete data
db.delete("Hello");
db.get("Hello"); // undefined
db.has("Hello"); // false
db.set("age", 10);
db.add("age", 1); // 11
db.subtract("age", 9); // 2
db.set("array", [ "apple" ]);
db.push("array", "orange"); // [ "apple", "orange" ]
// Clear data
db.deleteAll();
// Get all the data
db.all();