pub struct PostgresIoTRepository { /* private fields */ }Expand description
PostgreSQL implementation of IoT repository
Implementations§
Trait Implementations§
Source§impl IoTRepository for PostgresIoTRepository
impl IoTRepository for PostgresIoTRepository
Source§fn create_reading<'life0, 'life1, 'async_trait>(
&'life0 self,
reading: &'life1 IoTReading,
) -> Pin<Box<dyn Future<Output = Result<IoTReading, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_reading<'life0, 'life1, 'async_trait>(
&'life0 self,
reading: &'life1 IoTReading,
) -> Pin<Box<dyn Future<Output = Result<IoTReading, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new IoT reading
Source§fn create_readings_bulk<'life0, 'life1, 'async_trait>(
&'life0 self,
readings: &'life1 [IoTReading],
) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_readings_bulk<'life0, 'life1, 'async_trait>(
&'life0 self,
readings: &'life1 [IoTReading],
) -> Pin<Box<dyn Future<Output = Result<usize, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create multiple IoT readings (bulk insert)
Source§fn find_readings_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: Option<DeviceType>,
metric_type: Option<MetricType>,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_readings_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: Option<DeviceType>,
metric_type: Option<MetricType>,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find readings by building and time range
Source§fn get_consumption_stats<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<ConsumptionStatsDto, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_consumption_stats<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<ConsumptionStatsDto, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get consumption statistics for a building
Source§fn get_daily_aggregates<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DailyAggregateDto>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_daily_aggregates<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DailyAggregateDto>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get daily aggregated readings
Source§fn get_monthly_aggregates<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MonthlyAggregateDto>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_monthly_aggregates<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MonthlyAggregateDto>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get monthly aggregated readings
Source§fn detect_anomalies<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
metric_type: MetricType,
threshold_percentage: f64,
lookback_days: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn detect_anomalies<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
metric_type: MetricType,
threshold_percentage: f64,
lookback_days: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<IoTReading>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Detect anomalies (readings exceeding average by threshold percentage)
Source§fn create_linky_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 LinkyDevice,
) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_linky_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 LinkyDevice,
) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new Linky device configuration
Source§fn find_linky_device_by_id<'life0, 'async_trait>(
&'life0 self,
device_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_linky_device_by_id<'life0, 'async_trait>(
&'life0 self,
device_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find Linky device by ID
Source§fn find_linky_device_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_linky_device_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find Linky device by building ID
Source§fn find_linky_device_by_prm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prm: &'life1 str,
provider: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find_linky_device_by_prm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prm: &'life1 str,
provider: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Find Linky device by PRM and provider
Source§fn update_linky_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 LinkyDevice,
) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_linky_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device: &'life1 LinkyDevice,
) -> Pin<Box<dyn Future<Output = Result<LinkyDevice, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update Linky device (tokens, sync status, etc.)
Source§fn delete_linky_device<'life0, 'async_trait>(
&'life0 self,
device_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_linky_device<'life0, 'async_trait>(
&'life0 self,
device_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete Linky device
Source§fn find_devices_needing_sync<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_devices_needing_sync<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkyDevice>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all Linky devices that need sync (sync_enabled=true AND (never synced OR last_sync > 24h))
Auto Trait Implementations§
impl Freeze for PostgresIoTRepository
impl !RefUnwindSafe for PostgresIoTRepository
impl Send for PostgresIoTRepository
impl Sync for PostgresIoTRepository
impl Unpin for PostgresIoTRepository
impl UnsafeUnpin for PostgresIoTRepository
impl !UnwindSafe for PostgresIoTRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.