jerious-local-database
v1.5.1
Published
Database Node.js project using JSON as storage
Readme
LocalDatabase
A Local Database made with typescript
Dependencies:
import fs from 'fs'NPM Dependency:
import * as Database from 'jerious-local-database'Features:
- Search for queries
- Edit queries
- Delete queries
- Add queries
How it works:
Can search for objects, edit objects, etc (with json objects), using a .json file as a database (all locally)
Usage example:
JSON Object (representation)
| Key | Value | | ------------- | ------------- | | password: | "auserpassoword123" | | e_mail: | "[email protected]" | | user_name: | "username123" |
Getting object from query
Database.getFromQuery({
e_mail: "[email protected]",
password: "auserpassoword123"
})returns:
{
e_mail: "[email protected]",
password: "auserpassoword123",
user_name: "username123"
}Updating object from query
Database.updateFromQuery({
e_mail: "[email protected]",
password: "auserpassoword123"
}, {
user_name: "usernameupdated",
new_key: "astringvalue"
})updated object:
{
e_mail: "[email protected]",
password: "auserpassoword123",
user_name: "usernameupdated",
new_key: "astringvalue"
}Checking if database contains query
Database.containsQuery({
e_mail: "[email protected]",
password: "auserpassoword123"
})returns:
trueAdding object to database
Database.addObject({
e_mail: "[email protected]",
password: "aoutlookuserpassoword123"
})adds the object to the database.
How to setup in node:
Importing
import * as Database from './path/to/the/database/main/file'Initing
const a_db = new Database.Database('path/to/your/database/json/file')