@abmsourav/localdb 中文文档教程
LocalDB
LocalDB 是一个 NodeJS CRUD API。 它使用本地文件系统进行 CRUD 操作。 这是一个基于承诺的 API。
Installation
npm i @abmsourav/localdb
API
GET localDB.get()
POST localDB.set(jsonObject)
INSERT localDB.insert(jsonObject, jsonObject)
更新 localDB.update(jsonObject, jsonObject)
DELETE localDB.remove(jsonObject)
搜索 localDB.search(string, string, bool)
SEARCH localDB.searchByValue(string, bool)
Initialization
在您的项目根目录上创建一个 json 文件并像下面这样初始化。 请注意:它必须是一个 json 文件。
const ldb = localDB('./db.json');
API Uses
const {localDB} = require('@abmsourav/localdb');
const ldb = localDB('./db.json');
const data = {names: "Sourav", email: "keramotul.islam@gmail.com"};
// add new data
ldb.set(data)
.catch( (err) => console.log(err) );
// Insert data on and existing object
ldb.insert({"id": "1247flsf"}, {"Full Name": "Keramot UL Islam"}) // 1. find the object, 2. add property and value
.catch( (err) => console.log(err) );
// get data from localDB
ldb.get()
.then( (data) => console.log(data) ) // [ {name: 'Sourav', email: 'keramotul.islam@gmail.com'} ]
.catch( (err) => console.log(err) );
// update data
ldb.update({"id": "abm"}, {name: "AbmSourav"}) // args: 1.where update'll made, 2.new data
.catch( err => console.log(err) );
// Delete data
ldb.remove({name: "Abm Sourav"})
.catch( err => console.log(err) );
// Search unique data
ldb.search("id", "123454ls") // key and value
.then( data => console.log(data) );
// search all matches data
ldb.search("name", "Sourav", false) // key, value and unique
.then( data => console.log(data) );
// Search all data that matches this value
ldb.searchByValue("Abm Sourav")
.then( data => console.log(data) );
// Search unique data that matches the value
ldb.searchByValue("Abm Sourav", true)
.then( data => console.log(data) );
LocalDB
LocalDB is a NodeJS CRUD API. It uses local file system for CRUD operation. It's a promise based API.
Installation
npm i @abmsourav/localdb
API
GET localDB.get()
POST localDB.set(jsonObject)
INSERT localDB.insert(jsonObject, jsonObject)
UPDATE localDB.update(jsonObject, jsonObject)
DELETE localDB.remove(jsonObject)
SEARCH localDB.search(string, string, bool)
SEARCH localDB.searchByValue(string, bool)
Initialization
create a json file on your project root and initialize like below. Please note: It must be a json file.
const ldb = localDB('./db.json');
API Uses
const {localDB} = require('@abmsourav/localdb');
const ldb = localDB('./db.json');
const data = {names: "Sourav", email: "keramotul.islam@gmail.com"};
// add new data
ldb.set(data)
.catch( (err) => console.log(err) );
// Insert data on and existing object
ldb.insert({"id": "1247flsf"}, {"Full Name": "Keramot UL Islam"}) // 1. find the object, 2. add property and value
.catch( (err) => console.log(err) );
// get data from localDB
ldb.get()
.then( (data) => console.log(data) ) // [ {name: 'Sourav', email: 'keramotul.islam@gmail.com'} ]
.catch( (err) => console.log(err) );
// update data
ldb.update({"id": "abm"}, {name: "AbmSourav"}) // args: 1.where update'll made, 2.new data
.catch( err => console.log(err) );
// Delete data
ldb.remove({name: "Abm Sourav"})
.catch( err => console.log(err) );
// Search unique data
ldb.search("id", "123454ls") // key and value
.then( data => console.log(data) );
// search all matches data
ldb.search("name", "Sourav", false) // key, value and unique
.then( data => console.log(data) );
// Search all data that matches this value
ldb.searchByValue("Abm Sourav")
.then( data => console.log(data) );
// Search unique data that matches the value
ldb.searchByValue("Abm Sourav", true)
.then( data => console.log(data) );
你可能也喜欢
- @1point7point4/id 中文文档教程
- @24hr/react-structured-data 中文文档教程
- @3dexpress/starwar-names 中文文档教程
- @4geit/rct-right-side-menu-component 中文文档教程
- @4geit/rct-todo-component 中文文档教程
- @4geit/swg-message-model 中文文档教程
- @4kmarket/contract-addresses 中文文档教程
- @512ks/nec-common-web 中文文档教程
- @6river/nestjs-prom 中文文档教程
- @6thquake/react-material 中文文档教程