use std::{env, env::VarError};
pub mod activity;
+pub mod aggregates;
pub mod category;
pub mod comment;
pub mod comment_report;
pub mod comment_view;
pub mod community;
-pub mod community_view;
pub mod moderator;
pub mod moderator_views;
pub mod password_reset_request;
pub mod private_message_view;
pub mod schema;
pub mod site;
-pub mod site_view;
pub mod user;
pub mod user_mention;
pub mod user_mention_view;
-pub mod user_view;
+pub mod views;
pub type DbPool = diesel::r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
}
}
+pub(crate) trait ToSafe {
+ type SafeColumns;
+ fn safe_columns_tuple() -> Self::SafeColumns;
+}
+
pub fn get_database_url_from_env() -> Result<String, VarError> {
env::var("LEMMY_DATABASE_URL")
}
Regex::new(r"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$").unwrap();
}
+pub(crate) mod functions {
+ use diesel::sql_types::*;
+
+ sql_function! {
+ fn hot_rank(score: BigInt, time: Timestamp) -> Integer;
+ }
+}
+
#[cfg(test)]
mod tests {
use super::fuzzy_search;