A library to have your app interact with Firestore in Elm
Updates configuration.
A validated path type
An instance of this type can be constructed with build function.
CRUDs function can accept this type to run their opration as follows.
firestore
|> Firestore.root
|> Firestore.collection "users"
|> Firestore.document "user0"
|> Firestore.subCollection "tags"
|> Firestore.build
|> ExResult.toTask
|> Task.andThen (Firestore.list tagDecoder ListOptions.default)
|> Task.attempt GotUserItemTagsA collection path
A sub-collection path
A document path
Validates PathBuilder and converts it into Path if it is valid.
A record structure for a document fetched from Firestore.
A record structure composed of multiple documents fetched from Firestore.
Name field of Firestore document
Creates a document with a given document id.
Takes the document id as the first argument.
Insert a document into a collection.
The document will get a fresh document id.
Updates an existing document.
Creates one if not present.
Updates only specific fields.
If the fields do not exists, they will be created.
Deletes a document.
Will succeed if document does not exist.
Deletes a document.
Will fail if document does not exist.
A record structure for query operation result
Runs a query operation
This opeartion only accepts a path built with root or document.
An error type
This type is available in order to disregard type of errors between protocol related errors as Http_ or backend related errors as Response.
Data structure for errors from Firestore
An error type for invalid path
Data type for Transaction
Transaction ID
A time transaction commited at
Starts a new transaction.
Commits a transaction, while optionally updating and deleting documents.
Only readWrite transaction is currently supported which requires authorization that can be set via Config.withAuthorization function.
Transaction in Firetore works in a pattern of "unit of work". It requires sets of updates and deletes to be commited.
model.firestore
|> Firestore.begin
|> Task.map
(\transaction ->
transaction
|> Firestore.updateTx user1 newUser1
|> Firestore.deleteTx user2
)
|> Firestore.commit
|> Task.attempt CommitedGets a single document in transaction
Lists documents in transaction
Runs a query operation in transaction
This works as almost the same as runQuery function, but the difference is that this function accepts transaction.
Adds update into the transaction
Adds deletion into the transaction
Data type for Firestore.