Skip to content

Commit

Permalink
update to v1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajayos committed Aug 20, 2023
1 parent e05264f commit 9da66a2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions example.js.crswap
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const DB = require("./");

// Define a custom database file path
const customDBPath = "db/mydatabase.sql";

// Create an instance of the DB class
const nodedb = new DB(customDBPath);

async function main() {
// Set data using setDB
await nodedb.setDB("users", "ajay", { name: "Ajay o s", age: 20 });

// Get data using getDB
const ajay = await nodedb.getDB("users", "ajay");
console.log("Retrieved Data:", ajay);

// Get all rows using getDB
const allUsers = await nodedb.getDB("users");
console.log("All Users:", allUsers);

// Delete a specific row using deleteDB
await nodedb.deleteDB("users", "ajay");

// Delete an entire table using deleteDB
await nodedb.deleteDB("users");

// Set data without JSON stringifying using setDATA
await nodedb.setDATA("metadata", "version", 1.2);

// Get data without JSON parsing using getDATA
const version = await nodedb.getDATA("metadata", "version");
console.log("Version:", version);

// Delete a specific row using deleteDATA
await nodedb.deleteDATA("metadata", "version");

// Delete an entire table using deleteDATA
await nodedb.deleteDATA("metadata");
}

// Run the main function
main().catch((error) => {
console.error("An error occurred:", error);
});

0 comments on commit 9da66a2

Please sign in to comment.