use async_trait::async_trait; use dagger_sdk::Container; use crate::dagger_middleware::DaggerMiddleware; use super::RustService; pub struct Sqlx {} #[async_trait] impl DaggerMiddleware for Sqlx { async fn handle(&self, container: Container) -> eyre::Result { Ok(container.with_env_variable("SQLX_OFFLINE", "true")) } } pub trait SqlxExt { fn with_sqlx(&mut self) -> &mut Self { self } } impl SqlxExt for RustService { fn with_sqlx(&mut self) -> &mut Self { self.with_stage(super::RustServiceStage::BeforeBuild(Box::new(Sqlx {}))); self } }