Struct dittolive_ditto::store::Store [−][src]
pub struct Store { /* fields omitted */ }
Implementations
Returns a Collection
with the provided name.
Returns an object that lets you fetch or observe the collections in the store.
pub fn with_batched_write<F>(
&self,
f: F
) -> Result<Vec<WriteTransactionResult>, DittoError> where
for<'batch> F: FnOnce(ScopedStore<'batch>) -> Action<'batch>,
pub fn with_batched_write<F>(
&self,
f: F
) -> Result<Vec<WriteTransactionResult>, DittoError> where
for<'batch> F: FnOnce(ScopedStore<'batch>) -> Action<'batch>,
Allows you to group multiple operations together that affect multiple documents, potentially across multiple collections, without auto-committing on each operation.
At the end of the batch of operations, either batch.commit_changes()
or batch.revert_changes()
must be called.
Example
ditto.store().with_batched_write(|batch| {
let mut foo_coll = batch.collection("foo");
foo_coll.find...().remove();
let mut bar_coll = batch.collection("bar");
// Expensive multi-mutation op:
for _ in 0 .. 10_000 {
let doc = ...;
bar_coll.insert(doc, None, false);
}
// At this point, we must say whether we commit or revert
// these changes:
batch.commit_changes()
})
Returns a list of the names of collections in the store.
Returns a hash representing the current version of the given queries. When a document matching such queries gets mutated, the hash will change as well.
Please note that the hash depends on how queries are constructed, so you should make sure to always compare hashes generated with the same set of queries.
Returns a sequence of English words representing the current version of the given queries. When a document matching such queries gets mutated, the words will change as well.
Please note that the resulting sequence of words depends on how queries are constructed, so you should make sure to always compare hashes generated with the same set of queries.
pub fn register_live_query_webhook(
&self,
collection_name: &str,
query: &str,
url: &str
) -> Result<DocumentId, DittoError>
Returns a Timeseries
with the provided name.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Store
impl UnwindSafe for Store
Blanket Implementations
Mutably borrows from an owned value. Read more