INNER CODE UNIT · Rust

fetch_engine

gluesql/gluesql · storages/composite-storage/src/lib.rs:58

    fn fetch_engine(&self, table_name: &str) -> Result<String> {
        self.fetch_schema(table_name)?
            .and_then(|Schema { engine, .. }| engine)
            .or_else(|| self.default_engine.clone())
            .ok_or_else(|| Error::StorageMsg(format!("engine not found for table: {table_name}")))
    }

    fn fetch_storage(&self, table_name: &str) -> Result<&dyn IStorage> {
        let engine = self.fetch_engine(table_name)?;

        self.storages.get(&engine).map(Box::as_ref).ok_or_else(|| {
            Error::StorageMsg(format!(
                "[fetch_storage] storage not found for table: {table_name}"
            ))
        })
    }

    fn fetch_storage_mut(&mut self, table_name: &str) -> Result<&mut dyn IStorage> {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…