2019-06-30 01:25:33 +02:00
|
|
|
use actix::{Actor, Addr, SyncContext};
|
2019-04-25 23:52:17 +02:00
|
|
|
use diesel::prelude::*;
|
2019-04-25 00:37:29 +02:00
|
|
|
use slog::Drain;
|
2019-05-07 01:14:51 +02:00
|
|
|
use url::form_urlencoded::Parse;
|
2019-04-25 00:37:29 +02:00
|
|
|
|
2019-04-25 23:52:17 +02:00
|
|
|
pub struct DbExecutor(pub SqliteConnection);
|
|
|
|
|
|
|
|
impl Actor for DbExecutor {
|
|
|
|
type Context = SyncContext<Self>;
|
|
|
|
}
|
|
|
|
|
2019-04-25 00:37:29 +02:00
|
|
|
pub struct AppState {
|
|
|
|
pub log: slog::Logger,
|
2019-04-25 23:52:17 +02:00
|
|
|
pub db: Addr<DbExecutor>,
|
2019-04-25 00:37:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn setup_logging() -> slog::Logger {
|
|
|
|
let decorator = slog_term::TermDecorator::new().build();
|
|
|
|
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
|
|
|
|
let drain = slog_async::Async::new(drain).build().fuse();
|
|
|
|
slog::Logger::root(drain, o!())
|
|
|
|
}
|
2019-05-07 01:14:51 +02:00
|
|
|
|
|
|
|
pub fn validate_parsed_data(data: Parse) -> bool {
|
|
|
|
false
|
|
|
|
}
|