Package Exports
- coverage.db
- coverage.db/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coverage.db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
How To Download
npm install coverage.db
How To Use
SQL
const Database = require("coverage.db");
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();
Mongo
You have to await
const Database = require("coverage.db");
const db = new Database.Mongo("MONGO-URL");
async function test() {
// 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();
};
test();
JSON
const Database = require("coverage.db");
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();