From 4036d5771cb1c28b6c44ebecde05409a218abfeb Mon Sep 17 00:00:00 2001 From: Bat Date: Sun, 22 Apr 2018 16:11:58 +0100 Subject: [PATCH] Implement models::instance::Instance::get --- src/models/instance.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/models/instance.rs b/src/models/instance.rs index 3051516b..7d0944fc 100644 --- a/src/models/instance.rs +++ b/src/models/instance.rs @@ -43,8 +43,12 @@ impl Instance { .expect("Error saving new instance") } - pub fn get(id: i32) -> Option { - None + pub fn get(conn: &PgConnection, id: i32) -> Option { + instances::table.filter(instances::id.eq(id)) + .limit(1) + .load::(conn) + .expect("Error loading local instance infos") + .into_iter().nth(0) } pub fn block(&self) {}