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

Base DELETE query builder. More...

#include <relx/query/delete.hpp>

Public Types

using table_type = Table
 
using where_type = Where
 

Public Member Functions

 DeleteQuery (Table table, Where where=std::nullopt)
 Constructor for the DELETE query builder.
 
std::string to_sql () const
 Generate the SQL for this DELETE query.
 
std::vector< std::string > bind_params () const
 Get the bind parameters for this DELETE query.
 
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 delete using IN with values.
 

Detailed Description

template<TableType Table, typename Where = std::nullopt_t>
class relx::query::DeleteQuery< Table, Where >

Base DELETE query builder.

Template Parameters
TableTable to delete from
WhereOptional where condition

Definition at line 23 of file delete.hpp.

Member Typedef Documentation

◆ table_type

template<TableType Table, typename Where = std::nullopt_t>
using relx::query::DeleteQuery< Table, Where >::table_type = Table

Definition at line 25 of file delete.hpp.

◆ where_type

template<TableType Table, typename Where = std::nullopt_t>
using relx::query::DeleteQuery< Table, Where >::where_type = Where

Definition at line 26 of file delete.hpp.

Constructor & Destructor Documentation

◆ DeleteQuery()

template<TableType Table, typename Where = std::nullopt_t>
relx::query::DeleteQuery< Table, Where >::DeleteQuery ( Table  table,
Where  where = std::nullopt 
)
inlineexplicit

Constructor for the DELETE query builder.

Parameters
tableThe table to delete from
whereThe WHERE condition

Definition at line 31 of file delete.hpp.

Member Function Documentation

◆ bind_params()

template<TableType Table, typename Where = std::nullopt_t>
std::vector< std::string > relx::query::DeleteQuery< Table, Where >::bind_params ( ) const
inline

Get the bind parameters for this DELETE query.

Returns
Vector of bind parameters

Definition at line 52 of file delete.hpp.

◆ to_sql()

template<TableType Table, typename Where = std::nullopt_t>
std::string relx::query::DeleteQuery< Table, Where >::to_sql ( ) const
inline

Generate the SQL for this DELETE query.

Returns
The SQL string

Definition at line 36 of file delete.hpp.

◆ where()

template<TableType Table, typename Where = std::nullopt_t>
template<ConditionExpr Condition>
auto relx::query::DeleteQuery< Table, Where >::where ( const Condition &  cond) const
inline

Add a WHERE clause to the query.

Template Parameters
ConditionThe condition type
Parameters
condThe WHERE condition
Returns
New DeleteQuery with the WHERE clause added

Definition at line 71 of file delete.hpp.

◆ where_in()

template<TableType Table, typename Where = std::nullopt_t>
template<ColumnType Col, std::ranges::range Range>
requires std::convertible_to<std::ranges::range_value_t<Range>, std::string>
auto relx::query::DeleteQuery< Table, Where >::where_in ( const Col &  column,
const Range &  values 
) const
inline

Set a condition for filtering the rows to delete using IN with values.

Template Parameters
ColThe column type
RangeThe range type for IN values
Parameters
columnThe column to check
valuesThe values to check against
Returns
New DeleteQuery with the IN condition added

Definition at line 83 of file delete.hpp.


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