use actix::{Actor, SyncContext}; use chrono::NaiveDateTime; use diesel::mysql::MysqlConnection; use r2d2::Pool; use r2d2_diesel::ConnectionManager; use crate::schema::{passwords, transactions, users}; pub struct DbExecutor(pub Pool>); impl Actor for DbExecutor { type Context = SyncContext; } #[derive(Debug, Clone, Insertable)] #[table_name = "transactions"] pub struct NewTransaction<'a> { pub sender: u64, pub receiver: u64, pub amount: u64, pub sender_balance: u64, pub receiver_balance: u64, pub purpose: &'a str, } #[derive(Debug, Clone, Queryable)] pub struct User { pub id: u64, pub power_level: i32, pub name: String, pub created: NaiveDateTime, pub balance: u64, } #[derive(Debug, Clone, Insertable)] #[table_name = "users"] pub struct NewUser { pub power_level: i32, pub name: String, pub balance: u64, } #[derive(Debug, Clone, Queryable)] pub struct Password { pub id: u64, pub hash: String, } #[derive(Debug, Clone, Insertable)] #[table_name = "passwords"] pub struct NewPassword<'a> { pub id: u64, pub hash: &'a str, }