relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
relx::schema::create_table< Table > Class Template Reference

Generate CREATE TABLE SQL statement for a table struct. More...

#include <relx/schema/table.hpp>

Public Member Functions

 create_table (const Table &table_instance)
 
create_tableif_not_exists (bool if_not_exists=true)
 
create_tableif_exists (bool if_exists=true)
 
create_tablecascade (bool cascade=true)
 
create_tablerestrict (bool restrict=true)
 
std::optional< std::string > validate () const
 Validate the create table configuration.
 
std::string to_sql () const
 
const std::vector< std::string > & bind_params () const
 

Detailed Description

template<TableConcept Table>
class relx::schema::create_table< Table >

Generate CREATE TABLE SQL statement for a table struct.

Template Parameters
TableThe table struct type
Parameters
table_instanceAn instance of the table
Returns
SQL string to create the table

Definition at line 113 of file table.hpp.

Constructor & Destructor Documentation

◆ create_table()

template<TableConcept Table>
relx::schema::create_table< Table >::create_table ( const Table &  table_instance)
inline

Definition at line 125 of file table.hpp.

Member Function Documentation

◆ bind_params()

template<TableConcept Table>
const std::vector< std::string > & relx::schema::create_table< Table >::bind_params ( ) const
inline

Definition at line 180 of file table.hpp.

◆ cascade()

template<TableConcept Table>
create_table & relx::schema::create_table< Table >::cascade ( bool  cascade = true)
inline

Definition at line 137 of file table.hpp.

◆ if_exists()

template<TableConcept Table>
create_table & relx::schema::create_table< Table >::if_exists ( bool  if_exists = true)
inline

Definition at line 132 of file table.hpp.

◆ if_not_exists()

template<TableConcept Table>
create_table & relx::schema::create_table< Table >::if_not_exists ( bool  if_not_exists = true)
inline

Definition at line 127 of file table.hpp.

◆ restrict()

template<TableConcept Table>
create_table & relx::schema::create_table< Table >::restrict ( bool  restrict = true)
inline

Definition at line 142 of file table.hpp.

◆ to_sql()

template<TableConcept Table>
std::string relx::schema::create_table< Table >::to_sql ( ) const
inline

Definition at line 156 of file table.hpp.

◆ validate()

template<TableConcept Table>
std::optional< std::string > relx::schema::create_table< Table >::validate ( ) const
inline

Validate the create table configuration.

Returns
Empty optional on success, error message on failure

Definition at line 149 of file table.hpp.


The documentation for this class was generated from the following file: