Skip to content

This is an open-source database management system made and managed by members of SupperSource and contributors.

License

Notifications You must be signed in to change notification settings

SupperSource/crud-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

This is an open-source database management system made and managed by zaid ajani.

how to install it?

to install this and use it, just open the terminal and enter npm i crud-db --save

Documentation

In node.js, import it like

const db = require('crud-db');

The basic functions.

As we import the library, on the top of the document, you'll need to initialize the database using .initialize() function.

example:

const db = require('crud-db');

db.initialize();

This command will create an empty database file as database.dbs in the folder you are currently working on.


command 2: Add the data using .add() function.

You have probably heard of the phrase key-value pair.

This database is managed on the same.

db.add(key, value);

example:

const db = require('crud-db');

db.initialize();
db.add('crud-db', 'is the most simplest db ever.');

Then in the database.dbs, it will add a row as

{"crud-db":"is the most simplest db ever."}
  • you can even update key-value pairs in the same manner.

You can update using the same command.

use the same command and in the first parameter, suply the name of the key which you want to update, and in the second parameter, suply the value for the key.

example, if I have a key-value pair in the database as

{"crud-db":"is the most simplest db ever."}

then the code to update it would be:

db.add('crud-db', 'The updated value');
// it will update.

command 3: delete

To delete, use the .vanish() function.

example:

db.vanish('crud-db');

it will get deleted!.

command 4: Get a particular key from the database.

use the .get() function to do this.

example:

console.log(db.get('crud-api'));
// this will console log the data of the key 'crud-api'
// you can even store it in a varialble.

Command 5: readAllData

Using the function .readAllData() you will be able to read all the data in the database, and can asign it to a variable, do some sorting, or just print it on to the console.

Example:

console.log(db.readAllData());

This will return All the content in the database at that particular time.

Fun fact:

The code of the application is so simple and small, that it is smaller than the readme, and is so functional!, As more contributions came, the code increased!

test

Run npm test to see how functional the app is and the testing status. If it is not working, make an issue on the repository.

Hacktoberfest

This project can have pull requests for hacktoberfest, and if it is relevant, or useful, it will surely be excepted!.

Enjoy the powerfull and simple database.