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 theHeatingStatsDataTransferTrait. It contains no data itself; its sole role is to provide thetransfer_heating_statsmethod.
§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§
- Heating
Stats Data Transfer - Implements the
HeatingStatsDataTransferTraitfor transferring heating statistics to the SQL database.