pub struct DatabaseReference { /* private fields */ }Implementations§
Source§impl DatabaseReference
impl DatabaseReference
pub fn child(&self, relative: &str) -> DatabaseResult<DatabaseReference>
Sourcepub fn parent(&self) -> Option<DatabaseReference>
pub fn parent(&self) -> Option<DatabaseReference>
Returns the parent of this reference, mirroring ref.parent in the JS SDK.
Sourcepub fn root(&self) -> DatabaseReference
pub fn root(&self) -> DatabaseReference
Returns the root of the database, mirroring ref.root in the JS SDK.
pub fn set(&self, value: Value) -> DatabaseResult<()>
Sourcepub fn query(&self) -> DatabaseQuery
pub fn query(&self) -> DatabaseQuery
Creates a query anchored at this reference, mirroring the JS query() helper.
Sourcepub fn order_by_child(&self, path: &str) -> DatabaseResult<DatabaseQuery>
pub fn order_by_child(&self, path: &str) -> DatabaseResult<DatabaseQuery>
Returns a query ordered by the provided child path, mirroring orderByChild().
Sourcepub fn order_by_key(&self) -> DatabaseResult<DatabaseQuery>
pub fn order_by_key(&self) -> DatabaseResult<DatabaseQuery>
Returns a query ordered by key, mirroring orderByKey().
Sourcepub fn order_by_value(&self) -> DatabaseResult<DatabaseQuery>
pub fn order_by_value(&self) -> DatabaseResult<DatabaseQuery>
Returns a query ordered by value, mirroring orderByValue().
Sourcepub fn order_by_priority(&self) -> DatabaseResult<DatabaseQuery>
pub fn order_by_priority(&self) -> DatabaseResult<DatabaseQuery>
Returns a query ordered by priority, mirroring orderByPriority().
Sourcepub fn on_value<F>(&self, callback: F) -> DatabaseResult<ListenerRegistration>
pub fn on_value<F>(&self, callback: F) -> DatabaseResult<ListenerRegistration>
Registers a value listener for this reference, mirroring onValue().
Sourcepub fn on_child_added<F>(
&self,
callback: F,
) -> DatabaseResult<ListenerRegistration>
pub fn on_child_added<F>( &self, callback: F, ) -> DatabaseResult<ListenerRegistration>
Registers an onChildAdded listener, mirroring the JS SDK.
Sourcepub fn on_child_changed<F>(
&self,
callback: F,
) -> DatabaseResult<ListenerRegistration>
pub fn on_child_changed<F>( &self, callback: F, ) -> DatabaseResult<ListenerRegistration>
Registers an onChildChanged listener, mirroring the JS SDK.
Sourcepub fn on_child_removed<F>(
&self,
callback: F,
) -> DatabaseResult<ListenerRegistration>
pub fn on_child_removed<F>( &self, callback: F, ) -> DatabaseResult<ListenerRegistration>
Registers an onChildRemoved listener, mirroring the JS SDK.
Sourcepub fn on_disconnect(&self) -> OnDisconnect
pub fn on_disconnect(&self) -> OnDisconnect
Returns a handle for configuring operations to run when the client disconnects.
Sourcepub fn run_transaction<F>(&self, _update: F) -> DatabaseResult<()>
pub fn run_transaction<F>(&self, _update: F) -> DatabaseResult<()>
Placeholder for the transaction API; returns an error until realtime transport exists.
Sourcepub fn update(&self, updates: Map<String, Value>) -> DatabaseResult<()>
pub fn update(&self, updates: Map<String, Value>) -> DatabaseResult<()>
Applies the provided partial updates to the current location using a single
REST PATCH call when available.
Each key represents a relative child path (e.g. "profile/name").
The method rejects empty keys to mirror the JS SDK behaviour.
pub fn get(&self) -> DatabaseResult<Value>
Sourcepub fn remove(&self) -> DatabaseResult<()>
pub fn remove(&self) -> DatabaseResult<()>
Deletes the value at this location using the backend’s DELETE support.
Sourcepub fn set_with_priority<V, P>(
&self,
value: V,
priority: P,
) -> DatabaseResult<()>
pub fn set_with_priority<V, P>( &self, value: V, priority: P, ) -> DatabaseResult<()>
Writes the provided value together with its priority, mirroring
setWithPriority() in packages/database/src/api/Reference_impl.ts.
Sourcepub fn set_priority<P>(&self, priority: P) -> DatabaseResult<()>
pub fn set_priority<P>(&self, priority: P) -> DatabaseResult<()>
Updates the priority for this location, mirroring setPriority() in the JS SDK.
Sourcepub fn push(&self) -> DatabaseResult<DatabaseReference>
pub fn push(&self) -> DatabaseResult<DatabaseReference>
Creates a child location with an auto-generated key, mirroring push() from the JS SDK.
Port of push() in packages/database/src/api/Reference_impl.ts.
§Examples
let new_message = messages.push_with_value(json!({ "text": "hi" }))?;
assert!(new_message.key().is_some());Sourcepub fn push_with_value<V>(&self, value: V) -> DatabaseResult<DatabaseReference>
pub fn push_with_value<V>(&self, value: V) -> DatabaseResult<DatabaseReference>
Creates a child location with an auto-generated key and writes the provided value.
Mirrors the push(ref, value) overload from packages/database/src/api/Reference_impl.ts.
Sourcepub fn key(&self) -> Option<&str>
pub fn key(&self) -> Option<&str>
Returns the last path segment (the key) for this reference, mirroring
ref.key in the JS SDK.
pub fn path(&self) -> String
Trait Implementations§
Source§impl Clone for DatabaseReference
impl Clone for DatabaseReference
Source§fn clone(&self) -> DatabaseReference
fn clone(&self) -> DatabaseReference
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more