From 9c177f6286ff0496927b38a3c48877428f51944d Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 9 Jan 2022 09:31:03 +0900 Subject: [PATCH] Change format_datetime implementation according to feature --- plume-models/src/posts.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index f425f6bc..391ede1f 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -950,6 +950,7 @@ mod tests { use diesel::Connection; use serde_json::{json, to_value}; + #[cfg(feature = "postgres")] fn format_datetime(dt: &NaiveDateTime) -> String { format!( "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}.{:06}Z", @@ -963,6 +964,19 @@ mod tests { ) } + #[cfg(feature = "sqlite")] + fn format_datetime(dt: &NaiveDateTime) -> String { + format!( + "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z", + dt.year(), + dt.month(), + dt.day(), + dt.hour(), + dt.minute(), + dt.second() + ) + } + fn prepare_activity(conn: &DbConn) -> (Post, Mention, Vec, Vec, Vec) { let (posts, users, blogs) = fill_database(conn); let post = &posts[0];