mirror of
https://github.com/getml/sqlgen.git
synced 2025-12-31 06:30:18 -06:00
sqlgen Documentation
Welcome to the sqlgen documentation. This guide provides detailed information about sqlgen's features and APIs.
Core Concepts
- Defining Tables - How to define tables using C++ structs
- sqlgen::col - How to represent columns in queries
- sqlgen::Flatten - How to "inherit" fields from other structs
- sqlgen::PrimaryKey - How to define primary keys in sqlgen
- sqlgen::Result - How sqlgen handles errors and results
- sqlgen::to_sql - How to transpile C++ operations to dialect-specific SQL
Database I/O
- sqlgen::read - How to read data from a database
- sqlgen::write - How to write data to a database
Database Operations
- sqlgen::create_index - How to create an index on a table
- sqlgen::create_table - How to create a new table
- sqlgen::delete_from - How to delete data from a table
- sqlgen::drop - How to drop a table
- sqlgen::exec - How to execute raw SQL statements
- sqlgen::insert - How to insert data within transactions
- sqlgen::update - How to update data in a table
Data Types and Validation
- sqlgen::Pattern - How to add regex pattern validation to avoid SQL injection
- sqlgen::Timestamp - How timestamps work in sqlgen
- sqlgen::Varchar - How varchars work in sqlgen
Other concepts
- Connection Pool - How to manage database connections efficiently
- Transactions - How to use transactions for atomic operations
Supported Databases
- PostgreSQL - How to interact with PostgreSQL and compatible databases (Redshift, Aurora, Greenplum, CockroachDB, ...)
- SQLite - How to interact with SQLite3
For installation instructions, quick start guide, and usage examples, please refer to the main README.