Module sql_interface_heating_stats_data_transfer

Source
Expand description

Contains data structure for transfer of heating statistics to the database Provides the concrete implementation for transferring heating statistics to a SQL database.

This module acts as a bridge, fulfilling the HeatingStatsDataTransferTrait contract by using the SqlInterfaceHeatingStats component. Its primary purpose is to decouple the core heating logic from the specific details of the database implementation, adhering to the Dependency Inversion Principle.

§Key Components

  • HeatingStatsDataTransfer: A simple unit struct that serves as the concrete implementation of the HeatingStatsDataTransferTrait. It contains no data itself; its sole role is to provide the transfer_heating_stats method.

§Design and Purpose

In a larger system, a high-level component (like a thermal controller) needs to persist statistics but should not be tightly coupled to the database code. Instead, it depends on an abstraction—the HeatingStatsDataTransferTrait.

This module provides the “glue” that connects the abstraction to the concrete SqlInterfaceHeatingStats implementation allowing usage of mock-implementation of the trait to verify that statistics are being generated correctly without needing a real database connection.

Structs§

HeatingStatsDataTransfer
Implements the HeatingStatsDataTransferTrait for transferring heating statistics to the SQL database.