How atarasin/oatpp-mysql works
Main Components
a. Oatpp-MySQL Core Library
• This includes the primary source code under the src/oatpp-mysql directory.
• Main classes such as Connection, ConnectionProvider, Executor, and QueryResult which handle establishing connections, executing queries, and processing results.
b. Mapping Module
• Located in src/oatpp-mysql/mapping, these files (Serializer, Deserializer, ResultMapper) handle the conversion between C++ objects and SQL result sets.
c. Query Template Module
• Found in src/oatpp-mysql/ql_template, this set of files (Parser, TemplateValueProvider) is responsible for handling dynamic SQL construction or template-based queries.
d. Testing and Validation
• The test directory contains various tests for each subcomponent (migrations, ql_template tests, types tests) ensuring that every module works as expected.
e. Build and Utility Scripts
• CMakeLists.txt files, cmake configuration scripts, and utility scripts for installing dependencies (e.g. utility/install-deps/install-my-dependency.sh and module-uninstall.sh) which are pivotal for automated builds and CI/CD.
f. Continuous Integration
• azure-pipelines.yml indicates that there is an Azure Pipelines setup for automated integration and testing.
Relationships and Interactions
a. The core library classes (Connection, ConnectionProvider) interact directly with the MySQL database and form the base of the integration.
b. The Executor class acts as a mediator between raw SQL execution and higher-level mapping operations.
c. The Mapping Module, which consists of serializer/deserializer utilities, sits on top of the raw database interactions to transform query results into usable objects.
d. The QL Template Module provides an abstraction layer for dynamically constructing SQL queries and integrates with both the core and mapping functionalities.
e. Testing components in the test directory mirror and validate these relationships.
Important Architectural Patterns and Design Principles
• Modularity: Distinct directories (oatpp-mysql, mapping, ql_template) emphasize separation of concerns.
• Abstraction: Usage of classes to abstract raw database operations (like ConnectionProvider and Executor).
• Reusability and Extensibility: The design allows for clear integration points (custom QL templates or mapping configurations) making the library adaptable.
• CI/CD integration: With Azure Pipelines and CMake configuration, the design is oriented towards maintainability and continuous development.
• Out the internal library components in layered sections (e.g., bottom layer handling raw DB connections, middle layer handling query execution, upper layer managing object mapping).
• That you capture build and deployment components if relevant, such as the role of CMake and the Azure Pipelines.