kaizer-db

1.2.2 • Public • Published

Kaizer DB

A lightweight and minimal csv database package

logo Buy Me A Coffee

Features

  • SQL like syntax
  • Works directly with CSV
  • Supports all CRUD functionalities like INSERT, DELETE etc

Drawbacks

  • No type checking
  • Only one query at a time
  • Doesn't support data with spaces

Getting started

If you are using this package from the GitHub repository

  yarn start
  npm start

If you are using this package from the npm repository

  require('kaizer-db')

That's it! No fancy configuration or boiler code. It's as easy as that!!!

Usage

  • Creating or using a database

      Use Database dbname;
    
      Create Database dbname;
    

    Both these commands create a new folder named dbname where the tables are stored as csv files.

  • Show list of tables

      Show Tables;
    

    Shows list of available csv files in the current directory which is used as the database.

    first

  • Creating a table

     Create Table Warriors (Name,Attack,Defense,PowerLevel);
    

    Creates a file named Warriors.csv in the current folder dbname with the given headers.

  • Inserting data in a table

      Insert into Warriors (Name,Attack,Defense,PowerLevel) values (Goku,5000,7000,9001), (Vegeta,5000,7000,9000);
    

    Appends 2 records to the file named Warriors.csv

  • Getting records from a table

      Select * from Warriors;
    

    select1

      Select Name, PowerLevel from Warriors;
    

    select2

  • Getting records from a table using WHERE clause

      Select Name from Warriors Where PowerLevel > 9000;
    

    select3

  • Getting records from a table using multiple WHERE clauses

      Select * from Warriors Where PowerLevel > 9000 and Name = Goku;
    

    where1

      Select * from Warriors Where PowerLevel > 9000 or Name = Vegeta;
    

    where2

  • Updating a record using WHERE clause

      Update Table Warriors set PowerLevel = 10000, Defense = 8000 Where Name = Goku;
    

    updateQuery

  • Deleting a record using WHERE clause

      Delete From Warriors Where PowerLevel < 10000;
    

    select5

How to contribute

  • Fork the repository in your GitHub account.
  • Make your changes.
  • Submit a pull request.
  • Code should well documented.

Readme

Keywords

Package Sidebar

Install

npm i kaizer-db

Weekly Downloads

17

Version

1.2.2

License

MIT

Unpacked Size

31.2 kB

Total Files

11

Last publish

Collaborators

  • darkmortal