feat: return with sqlx
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-04-05 23:01:11 +02:00
parent 2daa0864e2
commit 8b080f2f43
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -62,29 +62,20 @@ impl DaggerMiddleware for Sqlx {
} }
pub trait SqlxExt { pub trait SqlxExt {
fn with_sqlx(&mut self) -> &mut Self { fn with_sqlx(&mut self) -> &mut Self;
self fn with_sqlx_migrations(&mut self, path: impl Into<PathBuf>) -> &mut Self;
}
fn with_sqlx_migrations(&mut self, path: impl Into<PathBuf>) -> &mut Self {
self
}
} }
impl SqlxExt for RustService { impl SqlxExt for RustService {
fn with_sqlx(&mut self) -> &mut Self { fn with_sqlx(&mut self) -> &mut Self {
self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new(Sqlx::new( self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new(Sqlx::new(
self.client.clone(), self.client.clone(),
)))); ))))
self
} }
fn with_sqlx_migrations(&mut self, path: impl Into<PathBuf>) -> &mut Self { fn with_sqlx_migrations(&mut self, path: impl Into<PathBuf>) -> &mut Self {
self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new( self.with_stage(super::RustServiceStage::BeforeBuild(Arc::new(
Sqlx::new(self.client.clone()).with_migration_path(path), Sqlx::new(self.client.clone()).with_migration_path(path),
))); )))
self
} }
} }