38 lines
873 B
Rust
38 lines
873 B
Rust
|
use actix::Actor;
|
||
|
use config::{AppConfig, UpdateConfig};
|
||
|
use fake::{Fake, Faker};
|
||
|
|
||
|
pub struct Opts;
|
||
|
impl UpdateConfig for Opts {
|
||
|
fn update_config(&self, _config: &mut AppConfig) {}
|
||
|
}
|
||
|
|
||
|
#[actix_web::main]
|
||
|
async fn main() {
|
||
|
dotenv::dotenv().ok();
|
||
|
std::env::set_var("RUST_LOG", "DEBUG");
|
||
|
pretty_env_logger::init();
|
||
|
|
||
|
let config = config::default_load(&Opts);
|
||
|
let db = database_manager::Database::build(config)
|
||
|
.await
|
||
|
.unwrap()
|
||
|
.start();
|
||
|
|
||
|
let mut users = Vec::with_capacity(10);
|
||
|
for _ in 0..10 {
|
||
|
match db
|
||
|
.send(Faker.fake::<database_manager::CreateAccount>())
|
||
|
.await
|
||
|
{
|
||
|
Ok(Ok(user)) => users.push(user),
|
||
|
Ok(Err(e)) => {
|
||
|
log::error!("{e}")
|
||
|
}
|
||
|
Err(e) => {
|
||
|
log::error!("{e}")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|