Expand description
Configuration of SqlInterface Defines the configuration structure for the application’s SQL database interface.
This module contains the SqlInterfaceConfig struct, which is a direct representation
of the [sql_interface] section in the application’s TOML configuration file. It serves
as a data container for all settings required to establish, manage, and validate the
database connection.
§Key Configuration Areas
The struct is organized into several logical groups of parameters:
-
Connection Details: Fields like
db_user,db_password,db_host,db_port, anddb_nameprovide the essential credentials for connecting to the MySQL server. -
Startup Validation:
db_tables: A list of table names that the application expects to exist. TheSqlInterfacewill verify their presence at startup.db_min_wait_timeout: Specifies the minimum requiredwait_timeouton the MySQL server to prevent premature connection drops. A value of0deactivates this check.max_rows_*: A series of fields (max_rows_balling_set_values,max_rows_data, etc.) that define the maximum acceptable number of rows for various log and configuration tables. This acts as a safeguard against uncontrolled table growth. A value of0deactivates the check for a specific table.
-
Operational Parameters:
db_ping_interval: The interval, in seconds, at which the application should ping the database to keep the connection alive and prevent server-side timeouts.
§Usage
An instance of SqlInterfaceConfig is created by deserializing the
[sql_interface] section of a .toml file. This instance is then passed to
SqlInterface::new() to initialize the main database connection pool for the
entire application.
Structs§
- SqlInterface
Config - This struct holds the configuration data for the SQL interface. The configuration is loaded from the .toml configuration file. This struct does not contain any implementation.