1.1.3 • Published 3 years ago

localedb v1.1.3

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

LocaleDb

LocaleDb can Convert Your Locale Project Storage Into a Database

Installation

npm install localedb

Importation

let localeDb = require("localedb");

Usage

Most of Functions are Promised Based So be aware to use it outside of async Functions.


Creating Database

let conn = await localeDb.createDB("MyDatabase");
  • localeDb.createDB(dbName) Creates Database In our Project Folder.
  • dbName takes String of Database Name You want to Create.
  • Returns Connections Object.

Connection to Already Created Database

let conn = await localeDb.ConnectDb("MyDatabase");
  • localeDb.ConnectDb(dbName) Connect to the Database.
  • dbName takes String of Database Name You want to Connect.
  • Returns Conection Object.

Deleting Database

await localeDb.deleteDB("MyDatabase");
  • localeDb.deleteDB(dbName) Delete The Database.
  • Returns LocaleDBPromiseDefaultResponse

Checking If Database Exists

await localeDb.isDBExists("MyDatabase");
  • localeDb.isDBExists(dbName) Checks if Database Exists or Not.
  • Returns boolean.

Db Connection Object

Db Connection Object Can Be Accessed by localeDb.ConnectDb(dbName).

let conn = await localeDb.Connect(dbName);
  • Returns Db Connection Object

Usage


Getting Database Info
await conn.getDbInfo();
  • Returns JSON Object Containing Database Information.
Creating Stage
await conn.createStage(stageName);
  • Takes stageName argument as the Name of the Stage Inside The Database.
  • Returns Stage Connection Object.
Connecting To Stage
let stage = await conn.ConnectStage(stageName);
  • Creates Stage if Does not Exists.
  • Returns Stage Connection Object.
Checking If Stage Exists
await conn.isStageExists(stageName);
  • Returns boolean.
Deleting Stage
await conn.deleteStage(stageName)
  • Returns LocaleDBPromiseDefaultResponse.

Stage Connection Object

Stage Connection Object Can Be Accessed by conn.ConnectStage(stageName).

let stage = await conn.ConnectStage(stageName);
  • Returns Stage Connection Object

Usage


Getting Parent Db Info
await stage.getDbInfo();
  • Returns JSON Object Containing Database Info.
Getting Stage Info
await stage.getStageInfo();
  • Returns JSON Object Containing Stage Info.
Adding Data To Stage
await stage.addData(data);
  • Takes JSON Object.
  • Automatically Add dataId Key If Not Provided to Given Data and Value Will be Unique.
  • Returns LocaleDBPromiseDefaultResponse Object.
Getting All Data From Stage
await stage.getAllData();
  • Returns LocaleDBPromiseDefaultResponse Containing result Array Of Data.
Getting Data Using dataId
await stage.getDataById(dataId);
  • Takes dataId as the Unique Key Generated/Provided While Adding Data.
  • Returns Single Object Or Array Of Object Containing Provided dataId.
Deleting Data By Id
await stage.deleteDataById(dataId);
  • Returns Arrary Of Deleted Data.
Clearing All Data From Stage
await stage.clear();
  • Returns LocaleDBPromiseDefaultResponse Object.
Updating Data Using dataId
await stage.updateDataById(dataId, data);
  • Takes Second Argument As the Data You Want to Update.
  • Returns LocaleDBPromiseDefaultResponse Object Containing updated Array Inside result Object.
Updating Data Using Keys
await stage.updateData(compareData, updateData);
  • Takes compareData As the Keys You Want to Compare with All Data
  • If data matches compareData's Keys and it Values, The Keys of data Will be Updated/Added to data Corresponding to the Keys of updateData.

1.1.1

3 years ago

1.0.19

3 years ago

1.1.0

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.1.3

3 years ago

1.0.4

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago