-use crate::db::category::*;
-use crate::db::comment::*;
-use crate::db::comment_view::*;
-use crate::db::community::*;
-use crate::db::community_view::*;
-use crate::db::moderator::*;
-use crate::db::moderator_views::*;
-use crate::db::password_reset_request::*;
-use crate::db::post::*;
-use crate::db::post_view::*;
-use crate::db::private_message::*;
-use crate::db::private_message_view::*;
-use crate::db::site::*;
-use crate::db::site_view::*;
-use crate::db::user::*;
-use crate::db::user_mention::*;
-use crate::db::user_mention_view::*;
-use crate::db::user_view::*;
-use crate::db::*;
use crate::{
- extract_usernames, fetch_iframely_and_pictshare_data, naive_from_unix, naive_now, remove_slurs,
- slur_check, slurs_vec_to_str,
+ db::{community::*, community_view::*, moderator::*, site::*, user::*, user_view::*},
+ websocket::WebsocketInfo,
+};
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
};
-use diesel::PgConnection;
use failure::Error;
-use serde::{Deserialize, Serialize};
pub mod comment;
pub mod community;
data: T,
}
-impl<T> Oper<T> {
- pub fn new(data: T) -> Oper<T> {
+impl<Data> Oper<Data> {
+ pub fn new(data: Data) -> Oper<Data> {
Oper { data }
}
}
-pub trait Perform<T> {
- fn perform(&self, conn: &PgConnection) -> Result<T, Error>
- where
- T: Sized;
+pub trait Perform {
+ type Response: serde::ser::Serialize + Send;
+
+ fn perform(
+ &self,
+ pool: Pool<ConnectionManager<PgConnection>>,
+ websocket_info: Option<WebsocketInfo>,
+ ) -> Result<Self::Response, Error>;
}