Trait HeatingStatsDataTransferTrait

Source
pub trait HeatingStatsDataTransferTrait {
    // Required method
    fn transfer_heating_stats(
        &mut self,
        data: HeatingStatsEntry,
        sql_interface_heating: &mut SqlInterfaceHeatingStats,
    ) -> Result<(), SqlInterfaceError>;
}
Expand description

Trait for the execution of data transfer to SQL database after midnight has arrived. This trait allows running the main control with a mock implementation for testing.

Required Methods§

Source

fn transfer_heating_stats( &mut self, data: HeatingStatsEntry, sql_interface_heating: &mut SqlInterfaceHeatingStats, ) -> Result<(), SqlInterfaceError>

Transfers a completed daily heating statistics entry to the database.

This function is called once per day, typically just after midnight, to persist the aggregated heating statistics (energy usage, average temperatures) for the previous day.

§Arguments
  • data - The HeatingStatsEntry struct containing the statistics for the day.
  • sql_interface_heating - A mutable reference to the SqlInterfaceHeatingStats instance, used for database interaction.
§Returns

An empty Result (Ok(())) on a successful database transaction.

§Errors

Returns an SqlInterfaceError if the database operation fails (e.g., connection issue, SQL error during insertion/update).

Implementors§