cargo fmt
This commit is contained in:
parent
a940ef5e83
commit
e2d2cebed8
@ -3,7 +3,7 @@ use teloxide::{
|
|||||||
utils::{command::BotCommands, render::RenderMessageTextHelper},
|
utils::{command::BotCommands, render::RenderMessageTextHelper},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::db::{DB, CallDB};
|
use crate::db::{CallDB, DB};
|
||||||
use crate::LogMsg;
|
use crate::LogMsg;
|
||||||
|
|
||||||
// These are should not appear in /help
|
// These are should not appear in /help
|
||||||
|
|||||||
@ -5,18 +5,18 @@ use std::os::unix::process::CommandExt;
|
|||||||
|
|
||||||
use self::models::*;
|
use self::models::*;
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use bb8::PooledConnection;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use diesel::query_builder::NoFromClause;
|
use diesel::query_builder::NoFromClause;
|
||||||
use diesel::query_builder::SelectStatement;
|
use diesel::query_builder::SelectStatement;
|
||||||
use diesel_async::pooled_connection::bb8::Pool;
|
use diesel_async::pooled_connection::bb8::Pool;
|
||||||
use bb8::PooledConnection;
|
|
||||||
use diesel_async::pooled_connection::AsyncDieselConnectionManager;
|
use diesel_async::pooled_connection::AsyncDieselConnectionManager;
|
||||||
use diesel_async::AsyncConnection;
|
use diesel_async::AsyncConnection;
|
||||||
use diesel_async::AsyncPgConnection;
|
use diesel_async::AsyncPgConnection;
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use enum_stringify::EnumStringify;
|
use enum_stringify::EnumStringify;
|
||||||
use async_trait::async_trait;
|
|
||||||
|
|
||||||
#[derive(EnumStringify)]
|
#[derive(EnumStringify)]
|
||||||
#[enum_stringify(case = "flat")]
|
#[enum_stringify(case = "flat")]
|
||||||
@ -50,7 +50,9 @@ impl DB {
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl CallDB for DB {
|
impl CallDB for DB {
|
||||||
async fn get_pool(&mut self) -> PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>> {
|
async fn get_pool(
|
||||||
|
&mut self,
|
||||||
|
) -> PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>> {
|
||||||
self.pool.get().await.unwrap()
|
self.pool.get().await.unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +60,9 @@ impl CallDB for DB {
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait CallDB {
|
pub trait CallDB {
|
||||||
//type C;
|
//type C;
|
||||||
async fn get_pool(&mut self) -> PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>>;
|
async fn get_pool(
|
||||||
|
&mut self,
|
||||||
|
) -> PooledConnection<'_, AsyncDieselConnectionManager<AsyncPgConnection>>;
|
||||||
//async fn get_pool(&mut self) -> PooledConnection<'_, AsyncDieselConnectionManager<C>>;
|
//async fn get_pool(&mut self) -> PooledConnection<'_, AsyncDieselConnectionManager<C>>;
|
||||||
async fn get_users(&mut self) -> Vec<User> {
|
async fn get_users(&mut self) -> Vec<User> {
|
||||||
use self::schema::users::dsl::*;
|
use self::schema::users::dsl::*;
|
||||||
@ -235,10 +239,7 @@ pub trait CallDB {
|
|||||||
Ok(new_event)
|
Ok(new_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_media(
|
async fn get_media(&mut self, literal: &str) -> Result<Vec<Media>, Box<dyn std::error::Error>> {
|
||||||
&mut self,
|
|
||||||
literal: &str,
|
|
||||||
) -> Result<Vec<Media>, Box<dyn std::error::Error>> {
|
|
||||||
use self::schema::media::dsl::*;
|
use self::schema::media::dsl::*;
|
||||||
let conn = &mut self.get_pool().await;
|
let conn = &mut self.get_pool().await;
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use crate::admin::{admin_command_handler, AdminCommands};
|
use crate::admin::{admin_command_handler, AdminCommands};
|
||||||
use crate::admin::{secret_command_handler, SecretCommands};
|
use crate::admin::{secret_command_handler, SecretCommands};
|
||||||
use crate::db::{DB, CallDB};
|
use crate::db::{CallDB, DB};
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use chrono_tz::Asia;
|
use chrono_tz::Asia;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user