dittolive_ditto::store::query_builder

Trait DittoMutDocument

Source
pub trait DittoMutDocument: DittoDocument {
    // Required methods
    fn get_mut<'doc, V: MutableValue<'doc>>(
        &'doc mut self,
        path: &str,
    ) -> Result<V, DittoError>;
    fn set<V: Serialize>(
        &mut self,
        path: &str,
        val: V,
    ) -> Result<(), DittoError>;
    fn set_as_default<V: Serialize>(
        &mut self,
        path: &str,
        val: V,
    ) -> Result<(), DittoError>;
    fn remove(&mut self, path: &str) -> Result<(), DittoError>;
    fn increment(&mut self, path: &str, amount: f64) -> Result<(), DittoError>;
}
๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead
Expand description

Required Methodsยง

Source

fn get_mut<'doc, V: MutableValue<'doc>>( &'doc mut self, path: &str, ) -> Result<V, DittoError>

๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead

Returns the value at a given path in the mutable document.

The parameter V represents the type expected at the given path. Note however that other peers may have changed this type and deserialization may fail.

Source

fn set<V: Serialize>(&mut self, path: &str, val: V) -> Result<(), DittoError>

๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead

Assigns a some serializable value to the document at the given path and removes any other information present at that path.

If the path does not exist it will be created.

Source

fn set_as_default<V: Serialize>( &mut self, path: &str, val: V, ) -> Result<(), DittoError>

๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead

Sets the value at the provided path and marks it as the default, indicating other peers in the network are expected to overwrite it.

Source

fn remove(&mut self, path: &str) -> Result<(), DittoError>

๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead

Remove the value from a document at a given path

Source

fn increment(&mut self, path: &str, amount: f64) -> Result<(), DittoError>

๐Ÿ‘ŽDeprecated: Use ditto.store().execute_v2(...) or ditto.store().register_observer_v2(...) instead

Increment (+/-) a counter by amount.

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง

Sourceยง

impl<T: BorrowMut<Document>> DittoMutDocument for T