feat: with sqlx
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-11-27 13:52:11 +01:00
parent 2a988c33a4
commit a0acb54896
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -3,6 +3,8 @@ use dagger_sdk::Container;
use crate::dagger_middleware::DaggerMiddleware;
use super::RustService;
pub struct Sqlx {}
#[async_trait]
impl DaggerMiddleware for Sqlx {
@ -10,3 +12,17 @@ impl DaggerMiddleware for Sqlx {
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
}
}