Fixed compile without SQL dbs

This commit is contained in:
mdecimus
2024-04-07 17:39:58 +02:00
parent 841b8000c4
commit 44f531ecf9
3 changed files with 20 additions and 4 deletions

View File

@@ -234,10 +234,7 @@ impl Stores {
// Add SQL queries as lookup stores
for (store_id, lookup_store) in self.stores.iter().filter_map(|(id, store)| {
if matches!(
store,
Store::MySQL(_) | Store::PostgreSQL(_) | Store::SQLite(_)
) {
if store.is_sql() {
Some((id.clone(), LookupStore::from(store.clone())))
} else {
None

View File

@@ -352,6 +352,13 @@ impl LookupStore {
Ok(())
}
pub fn is_sql(&self) -> bool {
match self {
LookupStore::Store(store) => store.is_sql(),
_ => false,
}
}
}
enum LookupValue<T> {

View File

@@ -677,6 +677,18 @@ impl Store {
pub fn is_none(&self) -> bool {
matches!(self, Self::None)
}
pub fn is_sql(&self) -> bool {
match self {
#[cfg(feature = "sqlite")]
Store::SQLite(_) => true,
#[cfg(feature = "postgres")]
Store::PostgreSQL(_) => true,
#[cfg(feature = "mysql")]
Store::MySQL(_) => true,
_ => false,
}
}
}
impl std::fmt::Debug for Store {