0.5.2 • Published 2 years ago

dbcopycat v0.5.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

What is dbcopycat

A JSON Database that saves your Json data in a file and makes it easy for you to perform CRUD operations.

Motivation

In small web projects, database connection is very troublesome and unnecessary in projects we usually do to improve ourselves. That's why we make use of static json files. Why don't we make our static json file dynamic with minimal code?

Features

  • Make your static json file dynamic.
  • Get persistent json data.
  • Get rid of database fees and hassle.
  • It is so fast compared to other databases that it behaves as if it is a static data. 'NO WAITING TIME'.

Getting started

Start converting your static json file to dynamic json file!

Install Database Copycat

$ npm i -g dbcopycat

Then...

$ dbcopycat init

Generates a db.json file with some data

Commands

getAll()

Fetch all data

const dbcopycat = require('dbcopycat');

var data = dbcopycat.getAll();

getById(arrayName, dataId)

Returns the data that matches the data id

const dbcopycat = require('dbcopycat');

dbcopycat.getById(arrayName, dataId);

add(arrayName, data)

Adds data to data

const dbcopycat = require('dbcopycat');

var data = {
    "id": 2,
    "categoryId": 1,
    "productName": "Chang",
    "quantityPerUnit": "24 - 12 oz bottles",
    "unitPrice": "21",
    "unitsInStock": 17
}

dbcopycat.add("arrayName", data);

deleteById(arrayName, dataId)

Deletes data that matches the data ID

const dbcopycat = require('dbcopycat');

dbcopycat.deleteById(arrayName, dataId);

update(arrayName, data)

Updates data that matches the data id

const dbcopycat = require('dbcopycat');

dbcopycat.update(arrayName, data);

filter(arrayName, condition)

Filters data by condition

const dbcopycat = require('dbcopycat');

dbcopycat.filter("arrayName", x => x.id == 1)

find(arrayName, condition)

Returns a single data suitable for the condition

const dbcopycat = require('dbcopycat');

dbcopycat.find("arrayName", x => x.categoryid == 1)

License

MIT

0.5.0

2 years ago

0.4.1

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.2

2 years ago

0.4.0

2 years ago

0.3.2

2 years ago

0.2.1

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

1.0.2

2 years ago

0.0.1

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago