How getml/sqlgen works
sqlgen is a C++20, reflection-integrated ORM and SQL query generator. The principal workflow maps model types and composable read/write operations into dynamic statements, translates those statements into backend-specific SQL, and uses a database connection to execute operations and parse results. Its documented surface also includes schema creation, inserts, updates, deletes, indexes, joins, aggregations, and explicit transactions. The graph reflects the README and sampled transpilation, parsing, session, and dialect code; backend execution details not shown in the excerpts are represented at their existing backend directories.
Main entry points: Session.hpp Session Operations · to_sql.hpp Dialect SQL Generation · Parser.hpp Type Parsing · Connection.hpp SQLite Backend
Components 18
Query and Schema
- Query Builders
include/sqlgen/select_from.hpp - Query Transpilation
include/sqlgen/transpilation/to_select_from.hpp - Schema DDL
include/sqlgen/create_table.hpp - Dynamic Statements
include/sqlgen/dynamic/Statement.hpp
Execution Runtime
- Type Parsing
include/sqlgen/parsing/Parser.hpp - Session Operations
include/sqlgen/Session.hpp - Transactions
include/sqlgen/Transaction.hpp - Typed Results
include/sqlgen/Result.hpp
Database Backends
- SQLite Backend
include/sqlgen/sqlite/Connection.hpp - PostgreSQL Backend
include/sqlgen/postgres/Connection.hpp - MySQL Backend
include/sqlgen/mysql/Connection.hpp - DuckDB Backend
include/sqlgen/duckdb/Connection.hpp - Dialect SQL Generation
include/sqlgen/transpilation/to_sql.hpp
Other components
- C++ Application
- Database
Connections 30
- C++ Application → Read API: builds read
- C++ Application → Write API: writes models
- Reflected Models → Query Transpilation: provides schema
- Read API → Query Builders: composes query
- Query Builders → Query Transpilation: translates query
- Write API → Schema DDL: creates table
- Write API → Dynamic Statements: forms write
- Schema DDL → Dynamic Statements: forms DDL
- Query Transpilation → Dynamic Statements: forms query
- Dynamic Statements → Session Operations: supplies statements
- Session Operations → Dialect SQL Generation: requests SQL
- Session Operations → Type Parsing: parses values
- Session Operations → Transactions: runs transaction
- Session Operations → Typed Results: returns outcomes
- Session Operations → SQLite Backend: dispatches operations
- Session Operations → PostgreSQL Backend: dispatches operations
- Session Operations → MySQL Backend: dispatches operations
- Session Operations → DuckDB Backend: dispatches operations
- Dialect SQL Generation → SQLite Backend: generates SQL
- Dialect SQL Generation → PostgreSQL Backend: generates SQL
- Dialect SQL Generation → MySQL Backend: generates SQL
- Dialect SQL Generation → DuckDB Backend: generates SQL
- SQLite Backend → Database: executes SQL
- PostgreSQL Backend → Database: executes SQL
- MySQL Backend → Database: executes SQL
- DuckDB Backend → Database: executes SQL
- SQLite Backend → Type Parsing: provides rows
- PostgreSQL Backend → Type Parsing: provides rows
- MySQL Backend → Type Parsing: provides rows
- DuckDB Backend → Type Parsing: provides rows