firebase:: firestore:: Transaction
#include <transaction.h>
Transaction provides methods to read and write data within a transaction.
Summary
You cannot create a Transaction
directly; use Firestore::RunTransaction()
function instead.
Constructors and Destructors |
|
---|---|
Transaction(const Transaction & other)
Deleted copy constructor.
|
|
~Transaction()
Destructor.
|
Public functions |
|
---|---|
Delete(const DocumentReference & document)
|
virtual void
Deletes the document referred to by the provided reference.
|
Get(const DocumentReference & document, Error *error_code, std::string *error_message)
|
virtual DocumentSnapshot
Reads the document referred by the provided reference.
|
Set(const DocumentReference & document, const MapFieldValue & data, const SetOptions & options)
|
virtual void
Writes to the document referred to by the provided reference.
|
Update(const DocumentReference & document, const MapFieldValue & data)
|
virtual void
Updates fields in the document referred to by the provided reference.
|
Update(const DocumentReference & document, const MapFieldPathValue & data)
|
virtual void
Updates fields in the document referred to by the provided reference.
|
operator=(const Transaction & other)=delete
|
Deleted copy assignment operator.
|
Protected functions |
|
---|---|
Transaction()=default
|
Default constructor, to be used only for mocking a
Transaction . |
Public functions
Delete
virtual void Delete( const DocumentReference & document )
Deletes the document referred to by the provided reference.
Details | |||
---|---|---|---|
Parameters |
|
Get
virtual DocumentSnapshot Get( const DocumentReference & document, Error *error_code, std::string *error_message )
Reads the document referred by the provided reference.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
The contents of the document at this DocumentReference or invalid DocumentSnapshot if there is any error.
|
Set
virtual void Set( const DocumentReference & document, const MapFieldValue & data, const SetOptions & options )
Writes to the document referred to by the provided reference.
If the document does not yet exist, it will be created. If you pass SetOptions, the provided data can be merged into an existing document.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
Transaction
Transaction( const Transaction & other )=delete
Deleted copy constructor.
A Transaction
object is only valid for the duration of the callback you pass to Firestore::RunTransaction()
and cannot be copied.
Update
virtual void Update( const DocumentReference & document, const MapFieldValue & data )
Updates fields in the document referred to by the provided reference.
If no document exists yet, the update will fail.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
Update
virtual void Update( const DocumentReference & document, const MapFieldPathValue & data )
Updates fields in the document referred to by the provided reference.
If no document exists yet, the update will fail.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
operator=
Transaction & operator=( const Transaction & other )=delete
Deleted copy assignment operator.
A Transaction
object is only valid for the duration of the callback you pass to Firestore::RunTransaction()
and cannot be copied.
~Transaction
virtual ~Transaction()
Destructor.