Add getter helper

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-09-28 11:21:06 +02:00
parent cf78f7192f
commit e86f36c215

View file

@ -58,6 +58,9 @@ pub trait EventStore<'a> {
-> Result<Vec<Result<FileLockEntry<'a>>>>
where P: AsRef<Path>,
Coll: AsRef<str>;
fn get_event_by_uid<ID>(&'a self, id: ID) -> Result<Option<FileLockEntry<'a>>>
where ID: AsRef<str>;
}
impl<'a> EventStore<'a> for Store {
@ -94,5 +97,11 @@ impl<'a> EventStore<'a> for Store {
})
.collect())
}
fn get_event_by_uid<ID>(&'a self, id: ID) -> Result<Option<FileLockEntry<'a>>>
where ID: AsRef<str>
{
self.get(crate::module_path::new_id(id.as_ref())?)
}
}