DatabaseReference(const DatabaseReference & reference)
DatabaseReference(DatabaseReference && reference)
~DatabaseReference()
Public functions | |
---|---|
Child(const char *path) const | Gets a reference to a location relative to this one. |
Child(const std::string & path) const | Gets a reference to a location relative to this one. |
GetParent() const | Gets the parent of this location, or get this location again if IsRoot(). |
GetRoot() const | Gets the root of the database. |
GoOffline() | void Manually disconnect Firebase Realtime Database from the server, and disable automatic reconnection. |
GoOnline() | void Manually reestablish connection to the Firebase Realtime Database server and enable automatic reconnection. |
OnDisconnect() | Get the disconnect handler, which controls what actions the server will perform to this location's data when this client disconnects. |
PushChild() const | Automatically generates a child location, create a reference to it, and returns that reference to it. |
RemoveValue() | Future< void > Removes the value at this location from the database. |
RemoveValueLastResult() | Future< void > Gets the result of the most recent call to RemoveValue();. |
RunTransaction(DoTransactionWithContext transaction_function, void *context, bool trigger_local_events) | Run a user-supplied callback function (passing in a context), possibly multiple times, to perform an atomic transaction on the database. |
RunTransaction(DoTransactionFunction transaction_function, bool trigger_local_events) | Run a user-supplied callback, possibly multiple times, to perform an atomic transaction on the database. |
RunTransaction(DoTransaction transaction_function, bool trigger_local_events) | Run a user-supplied callback function, possibly multiple times, to perform an atomic transaction on the database. |
RunTransactionLastResult() | Get the result of the most recent call to RunTransaction(). |
SetPriority(Variant priority) | Future< void > Sets the priority of this field, which controls its sort order relative to its siblings. |
SetPriorityLastResult() | Future< void > Gets the result of the most recent call to SetPriority(). |
SetValue(Variant value) | Future< void > Sets the data at this location to the given value. |
SetValueAndPriority(Variant value, Variant priority) | Future< void > Sets both the data and priority of this location. |
SetValueAndPriorityLastResult() | Future< void > Get the result of the most recent call to SetValueAndPriority(). |
SetValueLastResult() | Future< void > Gets the result of the most recent call to SetValue(). |
UpdateChildren(Variant values) | Future< void > Updates the specified child keys to the given values. |
UpdateChildren(const std::map< std::string, Variant > & values) | Future< void > Updates the specified child keys to the given values. |
UpdateChildrenLastResult() | Future< void > Gets the result of the most recent call to either version of UpdateChildren(). |
database() const | Database * Gets the database to which we refer. |
is_root() const | bool Returns true if this reference refers to the root of the database. |
is_valid() const override | virtual bool Returns true if this reference is valid, false if it is not valid. |
key() const | const char * Gets the string key of this database location. |
key_string() const | std::string Gets the string key of this database location. |
operator=(const DatabaseReference & reference) | Copy assignment operator. |
operator=(DatabaseReference && reference) | Move assignment operator. |
url() const | std::string Get the absolute URL of this reference. |
DatabaseReferenceChild(constchar*path)const
Gets a reference to a location relative to this one.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Child relative to this location. |
DatabaseReferenceChild(conststd::string&path)const
Gets a reference to a location relative to this one.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Child relative to this location. |
DatabaseReference()
Default constructor.
This creates an invalid DatabaseReference. Attempting to perform any operations on this reference will fail unless a valid DatabaseReference has been assigned to it.
DatabaseReference(constDatabaseReference&reference)
Copy constructor.
It's totally okay (and efficient) to copy DatabaseReference instances, as they simply point to the same location in the database.
Details | |||
---|---|---|---|
Parameters |
|
DatabaseReference(DatabaseReference&&reference)
Move constructor.
Moving is an efficient operation for DatabaseReference instances.
Details | |||
---|---|---|---|
Parameters |
|
DatabaseReferenceGetParent()const
Gets the parent of this location, or get this location again if IsRoot().
Details | |
---|---|
Returns | Parent of this location in the database, unless this location is the root, in which case it returns this same location again. |
DatabaseReferenceGetRoot()const
Gets the root of the database.
Details | |
---|---|
Returns | Root of the database. |
voidGoOffline()
Manually disconnect Firebase Realtime Database from the server, and disable automatic reconnection.
This will affect all other instances of DatabaseReference as well.
voidGoOnline()
Manually reestablish connection to the Firebase Realtime Database server and enable automatic reconnection.
This will affect all other instances of DatabaseReference as well.
DisconnectionHandler*OnDisconnect()
Get the disconnect handler, which controls what actions the server will perform to this location's data when this client disconnects.
Details | |
---|---|
Returns | Disconnection handler for this location. You can use this to queue up operations on the server to be performed when the client disconnects. |
DatabaseReferencePushChild()const
Automatically generates a child location, create a reference to it, and returns that reference to it.
Details | |
---|---|
Returns | A newly created child, with a unique key. |
Future<void>RemoveValue()
Removes the value at this location from the database.
This is an asynchronous operation which takes time to execute, and uses firebase::Future to return its result.
Details | |
---|---|
Returns |
Future<void>RemoveValueLastResult()
Gets the result of the most recent call to RemoveValue();.
Details | |
---|---|
Returns | Result of the most recent call to RemoveValue(). |
Future<DataSnapshot>RunTransaction(DoTransactionWithContexttransaction_function,void*context,booltrigger_local_events)
Run a user-supplied callback function (passing in a context), possibly multiple times, to perform an atomic transaction on the database.
See also:firebase::database::DoTransactionWithContext for more information.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
| ||||||
Returns | A Future result, which will complete when the transaction either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded and the transaction was committed, and the new value of the data will be returned in the DataSnapshot result. If the Error is kErrorTransactionAbortedByUser, the transaction was aborted because the transaction function returned kTransactionResultAbort, and the old value will be returned in DataSnapshot. Otherwise, if some other error occurred, Error and ErrorMessage will be set and DataSnapshot will be invalid. |
Future<DataSnapshot>RunTransaction(DoTransactionFunctiontransaction_function,booltrigger_local_events)
Run a user-supplied callback, possibly multiple times, to perform an atomic transaction on the database.
See also:firebase::database::DoTransactionFunction for more information.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A Future result, which will complete when the transaction either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded and the transaction was committed, and the new value of the data will be returned in the DataSnapshot result. If the Error is kErrorTransactionAbortedByUser, the transaction was aborted because the transaction function returned kTransactionResultAbort, and the old value will be returned in DataSnapshot. Otherwise, if some other error occurred, Error and ErrorMessage will be set and DataSnapshot will be invalid. |
Future<DataSnapshot>RunTransaction(DoTransactiontransaction_function,booltrigger_local_events)
Run a user-supplied callback function, possibly multiple times, to perform an atomic transaction on the database.
See also:firebase::database::DoTransaction for more information.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A Future result, which will complete when the transaction either succeeds or fails. When the Future is completed, if its Error is kErrorNone, the operation succeeded and the transaction was committed, and the new value of the data will be returned in the DataSnapshot result. If the Error is kErrorTransactionAbortedByUser, the transaction was aborted because the transaction function returned kTransactionResultAbort, and the old value will be returned in DataSnapshot. Otherwise, if some other error occurred, Error and ErrorMessage will be set and DataSnapshot will be invalid. |
Future<DataSnapshot>RunTransactionLastResult()
Get the result of the most recent call to RunTransaction().
Details | |
---|---|
Returns | Results of the most recent call to RunTransaction(). |
Future<void>SetPriority(Variantpriority)
Sets the priority of this field, which controls its sort order relative to its siblings.
In Firebase, children are sorted in the following order:
Children with the same priority (including no priority) are sorted by key: A. First, children with keys that can be parsed as 32-bit integers, sorted in ascending numerical order of their keys. B. Then, remaining children, sorted in ascending lexicographical order of their keys.
This is an asynchronous operation which takes time to execute, and uses firebase::Future to return its result.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns |
Future<void>SetPriorityLastResult()
Gets the result of the most recent call to SetPriority().
Details | |
---|---|
Returns | Result of the most recent call to SetPriority(). |
Future<void>SetValue(Variantvalue)
Sets the data at this location to the given value.
This is an asynchronous operation which takes time to execute, and uses firebase::Future to return its result.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns |
Future<void>SetValueAndPriority(Variantvalue,Variantpriority)
Sets both the data and priority of this location.
See SetValue() and SetPriority() for context on the parameters.
This is an asynchronous operation which takes time to execute, and uses firebase::Future to return its result.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
Future<void>SetValueAndPriorityLastResult()
Get the result of the most recent call to SetValueAndPriority().
Details | |
---|---|
Returns | Result of the most recent call to SetValueAndPriority(). |
Future<void>SetValueLastResult()
Gets the result of the most recent call to SetValue().
Details | |
---|---|
Returns | Result of the most recent call to SetValue(). |
Future<void>UpdateChildren(Variantvalues)
Updates the specified child keys to the given values.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns |
Future<void>UpdateChildren(conststd::map<std::string,Variant>&values)
Updates the specified child keys to the given values.
This is an asynchronous operation which takes time to execute, and uses firebase::Future to return its result.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns |
Future<void>UpdateChildrenLastResult()
Gets the result of the most recent call to either version of UpdateChildren().
Details | |
---|---|
Returns | Result of the most recent call to UpdateChildren(). |
Database*database()const
Gets the database to which we refer.
The pointer will remain valid indefinitely.
Details | |
---|---|
Returns | Firebase Database instance that this DatabaseReference refers to. |
boolis_root()const
Returns true if this reference refers to the root of the database.
Details | |
---|---|
Returns | true if this reference refers to the root of the database, false otherwise. |
virtualboolis_valid()constoverride
Returns true if this reference is valid, false if it is not valid.
DatabaseReferences constructed with the default constructor are considered invalid. An invalid reference could be returned by Database::GetReference() or Database::GetReferenceFromUrl() if you specify an incorrect location, or calling Query::GetReference() on an invalid query.
Details | |
---|---|
Returns | true if this reference is valid, false if this reference is invalid. |
constchar*key()const
Gets the string key of this database location.
The pointer is only valid while the DatabaseReference remains in memory.
Details | |
---|---|
Returns | String key of this database location, which will remain valid in memory until the DatabaseReference itself goes away. |
std::stringkey_string()const
Gets the string key of this database location.
Details | |
---|---|
Returns | String key of this database location. |
DatabaseReference&operator=(constDatabaseReference&reference)
Copy assignment operator.
It's totally okay (and efficient) to copy DatabaseReference instances, as they simply point to the same location in the database.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DatabaseReference. |
DatabaseReference&operator=(DatabaseReference&&reference)
Move assignment operator.
Moving is an efficient operation for DatabaseReference instances.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | Reference to the destination DatabaseReference. |
std::stringurl()const
Get the absolute URL of this reference.
Details | |
---|---|
Returns | The absolute URL of the location this reference refers to. |
virtual~DatabaseReference()
Required virtual destructor.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.