2.2.17 • Published 2 years ago

firebase-javascript-interface v2.2.17

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

firebase-javascript-interface@1.2.2

Functions to use firebase cloud firestore and realtime database like CRUD (Create Read Update Delete)

Functions (Now using firebase-admin)

Cloud Firestore

initialize(serviceAccount, databaseURL)

To initialize the database with service account json

Params:

  • serviceAccount {object} service account json
  • databaseURL {string} the url of the realtime database default value = ""

insert(table, value)

To insert new objects to the db

If the collection doesn't exist, it will be created, the Id is generated by firestore

Params:

  • table {string} the collection path ex: "users"
  • value {object} the object to save ex: { user: "sito"}

hardIsert(table, value)

To insert an object to the db with a specific id

If the collection doesn't exist, it will be created

Params:

  • table {string} the collection path ex: "users"
  • value {object} the object to save ex: { user: "sito", id:"myId"}

update(table, key, value)

To update an element Params:

  • table {string} the collection path ex: "users"
  • key {any} the query to find the element ex: "id", "equal", "sito"
  • value {object} the object to save ex: { user: "sito"}

See firestore queries structure

getValue(table, rQuery)

To fetch a single value from db Params:

getTable(table, rQuery, page, count)

To fetch a entire collection Params:

deleteDocuments(table, documents)

To erase elements from a collection Params:

  • table {string} the collection path ex: "users"
  • documents {string[]} array with the list of ids

deleteCollection(table)

To clean a entire collection Params:

  • table {string} the collection path ex: "users"

Realtime database

writeRealtime(path, data)

To set a value Params:

  • path {string} the path to set or update
  • data {object} the data to save

readRealtime(path)

To read a value Params:

  • path {string} the path to read

deleteRealtime(path)

To remove a value Params:

  • path {string} the path to remove
2.2.17

2 years ago

2.1.9

2 years ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

2.1.6

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

1.2.2

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

0.10.1

2 years ago

0.11.1

2 years ago

0.12.1

2 years ago

0.11.2

2 years ago

0.10.3

2 years ago

0.13.1

2 years ago

0.11.3

2 years ago

0.14.1

2 years ago

0.14.2

2 years ago

0.9.1

2 years ago

0.6.6

3 years ago

0.6.8

3 years ago

0.8.1

2 years ago

0.6.3

3 years ago

0.7.1

2 years ago

0.6.2

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago