|
relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
|
Represents a column in a database table. More...
#include <relx/schema/column.hpp>
Public Types | |
| using | table_type = TableT |
| The table type this column belongs to. | |
| using | value_type = T |
| The C++ type of the column. | |
Public Member Functions | |
| std::string | sql_definition () const |
| Get the SQL definition of this column. | |
| std::optional< T > | get_default_value () const |
| Get the default value if set. | |
| template<typename PatternType > requires std::convertible_to<PatternType, std::string> | |
| auto | like (PatternType &&pattern) const |
| Create a LIKE condition for this column. | |
| auto | is_null () const |
| Create an IS NULL condition for this column. | |
| auto | is_not_null () const |
| Create an IS NOT NULL condition for this column. | |
Static Public Member Functions | |
| static std::string | to_sql_string (const T &value) |
| Convert a C++ value to SQL string. | |
| static T | from_sql_string (const std::string &sql_str) |
| Parse a SQL string to C++ value. | |
Static Public Attributes | |
| static constexpr auto | name = Name |
| The column name. | |
| static constexpr auto | sql_type = column_traits<T>::sql_type_name |
| The SQL type of the column. | |
| static constexpr bool | nullable = column_traits<T>::nullable |
| Flag indicating if the column can be NULL. | |
Represents a column in a database table.
| TableT | The table type this column belongs to |
| Name | The name of the column as a string literal |
| T | The C++ type of the column |
| Modifiers | Additional column modifiers (UNIQUE, PRIMARY KEY, etc.) |
Definition at line 217 of file column.hpp.
| using relx::schema::column< TableT, Name, T, Modifiers >::table_type = TableT |
The table type this column belongs to.
Definition at line 220 of file column.hpp.
| using relx::schema::column< TableT, Name, T, Modifiers >::value_type = T |
The C++ type of the column.
Definition at line 223 of file column.hpp.
|
inlinestatic |
Parse a SQL string to C++ value.
| sql_str | The SQL string to parse |
Definition at line 261 of file column.hpp.
|
inline |
Get the default value if set.
Definition at line 267 of file column.hpp.
| auto relx::schema::column< TableT, Name, T, Modifiers >::is_not_null | ( | ) | const |
Create an IS NOT NULL condition for this column.
Definition at line 1441 of file operators.hpp.
| auto relx::schema::column< TableT, Name, T, Modifiers >::is_null | ( | ) | const |
Create an IS NULL condition for this column.
Definition at line 1436 of file operators.hpp.
| auto relx::schema::column< TableT, Name, T, Modifiers >::like | ( | PatternType && | pattern | ) | const |
Create a LIKE condition for this column.
| pattern | The pattern to match against |
Definition at line 1431 of file operators.hpp.
|
inline |
Get the SQL definition of this column.
Definition at line 236 of file column.hpp.
|
inlinestatic |
Convert a C++ value to SQL string.
| value | The value to convert |
Definition at line 254 of file column.hpp.
|
staticconstexpr |
The column name.
Definition at line 226 of file column.hpp.
|
staticconstexpr |
Flag indicating if the column can be NULL.
Definition at line 232 of file column.hpp.
|
staticconstexpr |
The SQL type of the column.
Definition at line 229 of file column.hpp.