@guidb/firestore
v0.0.1
Published
firebase store library :V no ads no track bro
Downloads
1
Maintainers
Readme
❄Content-Library
- 📰 0% Ads
- 💸 0% Tracker
- 📃 0% Logging
❄Docs
constructor
new firestore(data, encrypt)
exampletype data = json / string type encrpy = boolean
if encrypt fill data base 64 not "./firebase.json"
if no encrypt fill data "./firebase.json" get base 64 data here https://jpillora.com/base64-encoder/
example
//--! no encrpyt !--\\
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
//--! data encrpyt !--\\
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("data:application/json;base64,ewogICJ0eXBl.*", true)
- Get All
getAll(name)
example
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
async function test() {
var getall = await db.getAll("users")
console.log(getall)
}
test()
//--! Result log here !--\\
/*
[
{
id: '0bQBHNASCO2UDbiQvvx2',
data: { born: 1815, first: 'Ada', last: 'Lovelace' },
time: { update_seconds: 1626377997, update_nanoseconds: 305257000 }
},
{
id: '3JijGaZpac8ONq3pKBy3',
data: { last: 'Lovelace', born: 1815, first: 'Ada' },
time: { update_seconds: 1626377449, update_nanoseconds: 553502000 }
},
{
id: 'AhDWWUrGSpKeLgLHzSLV',
data: { first: 'Ada', born: 1815, last: 'Lovelace' },
time: { update_seconds: 1626378647, update_nanoseconds: 848145000 }
},
{
id: 'RncOIs28UpkGytJ4VPGO',
data: { born: 1815, last: 'Lovelace', first: 'Ada' },
time: { update_seconds: 1626378648, update_nanoseconds: 570016000 }
},
{
id: 'Y7aFXiYZwdj07m0da3RP',
data: { last: 'Lovelace', born: 1815, first: 'Ada' },
time: { update_seconds: 1626377444, update_nanoseconds: 724274000 }
},
{
id: 'data',
data: { data: 'oke' },
time: { update_seconds: 1626382819, update_nanoseconds: 730519000 }
},
{
id: 'data1',
data: { version: '2', title: 'new title' },
time: { update_seconds: 1626384801, update_nanoseconds: 749878000 }
},
{
id: 's00VrxQ4gqxcC4d4QSUd',
data: { first: 'Ada', born: 1815, last: 'Lovelace' },
time: { update_seconds: 1626378000, update_nanoseconds: 269695000 }
},
{
id: 'uhnILsXYzDagVwTn59Bs',
data: { last: 'Lovelace', first: 'Ada', born: 1815 },
time: { update_seconds: 1626377530, update_nanoseconds: 248835000 }
},
{
id: 'user',
data: { km: [Array] },
time: { update_seconds: 1626382982, update_nanoseconds: 392675000 }
}
]
*/
- Get get
db.get(name, id)
example
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
async function test() {
var get = await db.get("users", "data1")
console.log(get)
}
test()
//--! Result log here !--\\
/*
{
id: 'data1',
data: { version: '1', title: 'hay' },
time: { update_seconds: 1626384800, update_nanoseconds: 691138000 }
}
*/
- add
add(name, id, data)
example
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
async function test() {
var dataa = {
"title": "hay",
"version": "1"
}
var add = await db.add("users", "data1", dataa)
console.log(add)
}
test()
//--! Result log here !--\\
/*
{ writeTime: { seconds: 1626384800, nanoseconds: 691138000 } }
*/
- update
update(name, id, data_update)
example
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
async function test() {
var data_update = {
"title": "new title",
"version": "2"
}
var update = await db.update("users", "data1", data_update)
console.log(update)
}
test()
//--! Result log here !--\\
/*
{ writeTime: { seconds: 1626384801, nanoseconds: 749878000 } }
*/
- delete
delete(option)
example
var firestore = require("@guidb/firestore")
var db = new firestore.firestore("./firebase.json")
async function test() {
var Option = {
"type": "doc",
"name": "users",
"doc" : "datatemp"
}
var delet = await db.delete(Option)
console.log(delet)
}
test()
//--! Result log here !--\\
/*
WriteResult {
_writeTime: Timestamp { _seconds: 1626384802, _nanoseconds: 380867000 }
}
*/
❄To-Do
A list that i should do more for this project...
- ✔ crud
- 🔜 clone
- 🔜 diagram
🖥Requirements
- Node v10+ (Node v14 Recommended)
- Network connection