Struct qualia::Checkpoint
source · pub struct Checkpoint<'a> { /* private fields */ }
Expand description
A set of not-yet-committed changes to a Store
, as created by Store::checkpoint()
.
Implementations§
source§impl<'a> Checkpoint<'a>
impl<'a> Checkpoint<'a>
sourcepub fn commit(self, description: impl AsRef<str>) -> Result<()>
pub fn commit(self, description: impl AsRef<str>) -> Result<()>
Commit this transaction with the given description.
sourcepub fn add(&self, object: Object) -> Result<i64>
pub fn add(&self, object: Object) -> Result<i64>
Add an object to the store.
Returns the ID of the newly created object.
sourcepub fn add_with_id<O>(&self, object: &mut O) -> Result<()>where
O: Clone + ObjectShapeWithId + Into<Object>,
pub fn add_with_id<O>(&self, object: &mut O) -> Result<()>where O: Clone + ObjectShapeWithId + Into<Object>,
Add an object to the store.
Stores the ID inside the created object.
sourcepub fn query(&self, query: impl Into<QueryNode>) -> MutableCollection<'_>
pub fn query(&self, query: impl Into<QueryNode>) -> MutableCollection<'_>
Get a MutableCollection
of the objects matching the given query.
This can take either a QueryNode
or QueryBuilder
; you almost certainly want to use
the latter.
Methods from Deref<Target = Store>§
sourcepub fn all(&self) -> Collection<'_>
pub fn all(&self) -> Collection<'_>
Get a Collection
of all objects.
sourcepub fn query(&self, query: impl Into<QueryNode>) -> Collection<'_>
pub fn query(&self, query: impl Into<QueryNode>) -> Collection<'_>
Get a Collection
of the objects matching the given query.
This can take either a QueryNode
or QueryBuilder
; you almost certainly want to use
the latter.
sourcepub fn cached_map<F: FnMut(Object, &Store) -> Result<O>, O>(
&self,
query: impl Into<QueryNode>,
f: F
) -> Result<CachedMapping<F, O>>
pub fn cached_map<F: FnMut(Object, &Store) -> Result<O>, O>( &self, query: impl Into<QueryNode>, f: F ) -> Result<CachedMapping<F, O>>
Get a CachedMapping
of the objects matching the given query.
Objects will be fetched ahead of time.
sourcepub fn last_checkpoint_id(&self) -> Result<CheckpointId>
pub fn last_checkpoint_id(&self) -> Result<CheckpointId>
Get the ID of the last checkpoint, if any.
sourcepub fn modified_since(&self, a: CheckpointId) -> Result<bool>
pub fn modified_since(&self, a: CheckpointId) -> Result<bool>
Check if the store has been changed since the given checkpoint.