INNER CODE UNIT · Rust

build_backend

gluesql/glues · server/src/lib.rs:121

async fn build_backend(storage: StorageCommand) -> Result<Box<dyn CoreBackend + Send>> {
    let backend: Box<dyn CoreBackend + Send> = match storage {
        StorageCommand::Memory => Box::new(Db::memory().await?),
        StorageCommand::File { path } => Box::new(Db::file(&path).await?),
        StorageCommand::Redb { path } => Box::new(Db::redb(&path).await?),
        StorageCommand::Git {
            path,
            remote,
            branch,
        } => Box::new(Db::git(&path, remote, branch).await?),
        StorageCommand::Mongo { conn_str, db_name } => {
            Box::new(Db::mongo(&conn_str, &db_name).await?)
        }
    };

    Ok(backend)
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…