formating
This commit is contained in:
@@ -6,11 +6,10 @@
|
|||||||
pub mod influx;
|
pub mod influx;
|
||||||
pub mod postgres;
|
pub mod postgres;
|
||||||
|
|
||||||
// random functions for mqtt
|
// random functions for mqtt
|
||||||
pub mod mqtt;
|
pub mod mqtt;
|
||||||
pub mod unit_conversion;
|
pub mod unit_conversion;
|
||||||
|
|
||||||
|
|
||||||
// Commonly used types across the services
|
// Commonly used types across the services
|
||||||
mod types {
|
mod types {
|
||||||
pub mod mac; // deprecated for the time being.
|
pub mod mac; // deprecated for the time being.
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
|
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
|
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
|
||||||
|
|
||||||
pub type DbConn = diesel::pg::PgConnection;
|
pub type DbConn = diesel::pg::PgConnection;
|
||||||
|
|
||||||
// pub type DbPooledConn = PooledConnection<ConnectionManager<PgConnection>>;
|
|
||||||
pub type DbPool = Pool<ConnectionManager<PgConnection>>;
|
pub type DbPool = Pool<ConnectionManager<PgConnection>>;
|
||||||
|
|
||||||
pub struct DbPooledConn(pub PooledConnection<ConnectionManager<PgConnection>>);
|
pub struct DbPooledConn(pub PooledConnection<ConnectionManager<PgConnection>>);
|
||||||
|
|
||||||
|
|
||||||
pub fn establish_connection() -> DbConn {
|
pub fn establish_connection() -> DbConn {
|
||||||
let database_url = dotenv::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
let database_url = dotenv::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||||
PgConnection::establish(&database_url)
|
PgConnection::establish(&database_url)
|
||||||
@@ -26,4 +22,4 @@ impl std::ops::Deref for DbPooledConn {
|
|||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ use futures::stream::StreamExt;
|
|||||||
mod handler;
|
mod handler;
|
||||||
mod position_solver;
|
mod position_solver;
|
||||||
|
|
||||||
use kairo_common::mqtt::for_async::{
|
use kairo_common::mqtt::for_async::{get_mqtt_cli_and_stream, mqtt_cli_reconnect, mqtt_subscribe};
|
||||||
get_mqtt_cli_and_stream, mqtt_cli_reconnect, mqtt_subscribe,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user