feat: add command pattern
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -5,10 +5,12 @@ use crate::shared_engine::SharedEngine;
|
||||
mod local;
|
||||
mod remote;
|
||||
|
||||
#[derive(Clone)]
|
||||
enum QuerierVariant {
|
||||
Local(local::Querier),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Querier {
|
||||
variant: QuerierVariant,
|
||||
}
|
||||
@@ -30,6 +32,16 @@ impl Querier {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_async(
|
||||
&self,
|
||||
root: &str,
|
||||
path: impl IntoIterator<Item = impl Into<String>>,
|
||||
) -> Option<GraphItem> {
|
||||
match &self.variant {
|
||||
QuerierVariant::Local(querier) => querier.get(root, path),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_available_roots(&self) -> Option<Vec<String>> {
|
||||
match &self.variant {
|
||||
QuerierVariant::Local(querier) => querier.get_available_roots(),
|
||||
|
Reference in New Issue
Block a user