Lightweight 0.1.0
Loading...
Searching...
No Matches
Query Builder

The query builder is a high level API for building SQL queries using high level C++ syntax. More...

Classes

class  SqlQueryBuilder
 API Entry point for building SQL queries. More...
 
struct  SqlWildcardType
 SqlWildcardType is a placeholder for an explicit wildcard input parameter in a SQL query. More...
 
struct  SqlQualifiedTableColumnName
 SqlQualifiedTableColumnName represents a column name qualified with a table name. More...
 
class  SqlJoinConditionBuilder
 Query builder for building JOIN conditions. More...
 
class  SqlWhereClauseBuilder< Derived >
 
class  SqlDeleteQueryBuilder
 Query builder for building DELETE FROM ... queries. More...
 
class  SqlInsertQueryBuilder
 Query builder for building INSERT INTO ... queries. More...
 
class  SqlCreateTableQueryBuilder
 Query builder for building CREATE TABLE queries. More...
 
class  SqlAlterTableQueryBuilder
 Query builder for building ALTER TABLE queries. More...
 
class  SqlMigrationQueryBuilder
 Query builder for building SQL migration queries. More...
 
struct  SqlForeignKeyReferenceDefinition
 Represents a foreign key reference definition. More...
 
struct  SqlColumnDeclaration
 Represents a SQL column declaration. More...
 
struct  SqlAlterTablePlan
 Represents a SQL ALTER TABLE plan on a given table. More...
 
struct  SqlDropTablePlan
 Represents a SQL DROP TABLE plan. More...
 
struct  SqlMigrationPlan
 Represents a SQL migration plan. More...
 
class  SqlUpdateQueryBuilder
 Query builder for building UPDATE ... queries. More...
 

Typedefs

using SqlAlterTableCommand = std::variant< SqlAlterTableCommands::RenameTable, SqlAlterTableCommands::AddColumn, SqlAlterTableCommands::AlterColumn, SqlAlterTableCommands::AddIndex, SqlAlterTableCommands::RenameColumn, SqlAlterTableCommands::DropColumn, SqlAlterTableCommands::DropIndex, SqlAlterTableCommands::AddForeignKey, SqlAlterTableCommands::DropForeignKey >
 Represents a single SQL ALTER TABLE command.
 
using SqlMigrationPlanElement = std::variant< SqlCreateTablePlan, SqlAlterTablePlan, SqlDropTablePlan >
 Represents a single SQL migration plan element.
 

Enumerations

enum class  SqlPrimaryKeyType : uint8_t { NONE , MANUAL , AUTO_INCREMENT , GUID }
 Represents a primary key type. More...
 

Functions

LIGHTWEIGHT_API std::vector< std::string > ToSql (SqlQueryFormatter const &formatter, SqlMigrationPlanElement const &element)
 

Variables

template<typename T >
constexpr auto SqlColumnTypeDefinitionOf = detail::SqlColumnTypeDefinitionOf<T>::value
 Represents a SQL column type definition of T.
 

Detailed Description

The query builder is a high level API for building SQL queries using high level C++ syntax.

Typedef Documentation

◆ SqlAlterTableCommand

using SqlAlterTableCommand = std::variant<SqlAlterTableCommands::RenameTable, SqlAlterTableCommands::AddColumn, SqlAlterTableCommands::AlterColumn, SqlAlterTableCommands::AddIndex, SqlAlterTableCommands::RenameColumn, SqlAlterTableCommands::DropColumn, SqlAlterTableCommands::DropIndex, SqlAlterTableCommands::AddForeignKey, SqlAlterTableCommands::DropForeignKey>

Represents a single SQL ALTER TABLE command.

Definition at line 291 of file MigrationPlan.hpp.

◆ SqlMigrationPlanElement

using SqlMigrationPlanElement = std::variant< SqlCreateTablePlan, SqlAlterTablePlan, SqlDropTablePlan >

Represents a single SQL migration plan element.

This variant represents a single SQL migration plan element.

Definition at line 329 of file MigrationPlan.hpp.

Enumeration Type Documentation

◆ SqlPrimaryKeyType

enum class SqlPrimaryKeyType : uint8_t
strong

Represents a primary key type.

This enumeration represents the primary key type of a column.

Definition at line 172 of file MigrationPlan.hpp.

Function Documentation

◆ ToSql()

LIGHTWEIGHT_API std::vector< std::string > ToSql ( SqlQueryFormatter const &  formatter,
SqlMigrationPlanElement const &  element 
)

Formats the given SQL migration plan element as a list of SQL statements.

Parameters
formatterThe SQL query formatter to use.
elementThe SQL migration plan element to format.
Returns
A list of SQL statements.

Variable Documentation

◆ SqlColumnTypeDefinitionOf

template<typename T >
constexpr auto SqlColumnTypeDefinitionOf = detail::SqlColumnTypeDefinitionOf<T>::value
constexpr

Represents a SQL column type definition of T.

Definition at line 165 of file MigrationPlan.hpp.