|
| | UpdateQuery (Table table, Sets sets={}, Where where=std::nullopt, ReturningColumns returning_columns={}) |
| | Constructor for the UPDATE query builder.
|
| |
| std::string | to_sql () const |
| | Generate the SQL for this UPDATE query.
|
| |
| std::vector< std::string > | bind_params () const |
| | Get the bind parameters for this UPDATE query.
|
| |
| template<ColumnType Col, SqlExpr Val> |
| auto | set (const Col &column, Val &&val) const |
| | Add or replace a SET clause assignment.
|
| |
template<ColumnType Col, typename T >
requires (!SqlExpr<T>) |
| auto | set (const Col &column, T &&val) const |
| | Add or replace a SET clause assignment with a raw value (with type checking)
|
| |
| template<ConditionExpr Condition> |
| auto | where (const Condition &cond) const |
| | Add a WHERE clause to the query.
|
| |
template<ColumnType Col, std::ranges::range Range>
requires std::convertible_to<std::ranges::range_value_t<Range>, std::string> |
| auto | where_in (const Col &column, const Range &values) const |
| | Set a condition for filtering the rows to update using IN with values.
|
| |
| template<typename... Args> |
| auto | returning (const Args &... args) const |
| | Specify columns to return after update.
|
| |
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
class relx::query::UpdateQuery< Table, Sets, Where, ReturningColumns >
Base UPDATE query builder.
- Template Parameters
-
| Table | Table to update |
| Sets | Tuple of SET clause items |
| Where | Optional where condition |
| ReturningColumns | Tuple of column expressions to return after update |
Definition at line 43 of file update.hpp.
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
template<typename... Args>
Specify columns to return after update.
- Template Parameters
-
| Args | Column types or SQL expressions |
- Parameters
-
| args | The columns or expressions to return |
- Returns
- New UpdateQuery with the RETURNING clause added
Definition at line 223 of file update.hpp.
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
template<ColumnType Col, typename T >
requires (!SqlExpr<T>)
Add or replace a SET clause assignment with a raw value (with type checking)
- Template Parameters
-
| Col | The column type |
| T | The raw value type |
- Parameters
-
| column | The column to set |
| val | The raw value to set |
- Returns
- New UpdateQuery with the SET clause added
Definition at line 185 of file update.hpp.
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
template<ColumnType Col, SqlExpr Val>
Add or replace a SET clause assignment.
- Template Parameters
-
| Col | The column type |
| Val | The value expression type |
- Parameters
-
| column | The column to set |
| val | The value to set |
- Returns
- New UpdateQuery with the SET clause added
Definition at line 159 of file update.hpp.
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
template<ConditionExpr Condition>
Add a WHERE clause to the query.
- Template Parameters
-
| Condition | The condition type |
- Parameters
-
- Returns
- New UpdateQuery with the WHERE clause added
Definition at line 199 of file update.hpp.
template<TableType Table, typename Sets = std::tuple<>, typename Where = std::nullopt_t, typename ReturningColumns = std::tuple<>>
template<ColumnType Col, std::ranges::range Range>
requires std::convertible_to<std::ranges::range_value_t<Range>, std::string>
| auto relx::query::UpdateQuery< Table, Sets, Where, ReturningColumns >::where_in |
( |
const Col & |
column, |
|
|
const Range & |
values |
|
) |
| const |
|
inline |
Set a condition for filtering the rows to update using IN with values.
- Template Parameters
-
| Col | The column type |
| Range | The range type for IN values |
- Parameters
-
| column | The column to check |
| values | The values to check against |
- Returns
- New UpdateQuery with the IN condition added
Definition at line 212 of file update.hpp.