From 1ed60537cf702697caf460904350eb5e90c25e46 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 12 Sep 2021 03:57:12 +0900 Subject: [PATCH] Define Instance::get_locals() --- plume-models/src/instance.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index f8cb66cb..77f6f1b0 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -79,6 +79,13 @@ impl Instance { *LOCAL_INSTANCE.write().unwrap() = Instance::get_local_uncached(conn).ok(); } + pub fn get_locals(conn: &Connection) -> Result> { + instances::table + .filter(instances::local.eq(true)) + .load::(conn) + .map_err(Error::from) + } + pub fn get_remotes(conn: &Connection) -> Result> { instances::table .filter(instances::local.eq(false))