diff options
Diffstat (limited to 'src/db/models/job.rs')
-rw-r--r-- | src/db/models/job.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/db/models/job.rs b/src/db/models/job.rs index aa7b7f9..12af2a9 100644 --- a/src/db/models/job.rs +++ b/src/db/models/job.rs @@ -86,4 +86,15 @@ impl Job { .first::<Job>(database_connection) .map_err(Error::from) } + + pub fn env(&self, database_connection: &PgConnection) -> Result<Vec<crate::db::models::EnvVar>> { + use crate::schema; + + schema::job_envs::table + .inner_join(schema::envvars::table) + .filter(schema::job_envs::job_id.eq(self.id)) + .select(schema::envvars::all_columns) + .load::<crate::db::models::EnvVar>(database_connection) + .map_err(Error::from) + } } |