Lightweight 0.20261105.1
Loading...
Searching...
No Matches
Lightweight::SqlWhereClauseBuilder< Derived > Class Template Reference

#include <Core.hpp>

Inherited by Lightweight::SqlBasicSelectQueryBuilder< SqlAllFieldsQueryBuilder< Record, QueryOptions, SqlQueryExecutionMode::Synchronous > >, Lightweight::SqlBasicSelectQueryBuilder< SqlAllFieldsQueryBuilder< std::tuple< FirstRecord, SecondRecord >, QueryOptions, Execution > >, Lightweight::SqlBasicSelectQueryBuilder< SqlSelectQueryBuilder >, and Lightweight::SqlBasicSelectQueryBuilder< Derived >.

Classes

struct  PendingConnective
 What And(), Or() and Not() asked of the next condition. More...
 

Public Member Functions

Derived & And () noexcept
 Indicates, that the next WHERE clause should be AND-ed (default).
 
Derived & Or () noexcept
 Indicates, that the next WHERE clause should be OR-ed.
 
Derived & Not () noexcept
 Indicates, that the next WHERE clause should be negated.
 
Derived & WhereRaw (std::string_view sqlConditionExpression)
 Constructs or extends a raw WHERE clause.
 
template<typename T >
auto If (std::optional< T > const &value) noexcept
 Starts a conditional WHERE chain driven by a std::optional<T> value.
 
template<typename ColumnName , typename T >
Derived & Where (ColumnName const &columnName, std::string_view binaryOp, T const &value)
 Constructs or extends a WHERE clause to test for a binary operation.
 
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
Derived & Where (ColumnName const &columnName, std::string_view binaryOp, SubSelectQuery const &value)
 Constructs or extends a WHERE clause to test for a binary operation for RHS as sub-select query.
 
template<typename ColumnName , typename T >
Derived & OrWhere (ColumnName const &columnName, std::string_view binaryOp, T const &value)
 Constructs or extends a WHERE/OR clause to test for a binary operation.
 
template<typename ColumnName , std::size_t N>
Derived & Where (ColumnName const &columnName, std::string_view binaryOp, char const (&value)[N])
 Constructs or extends a WHERE clause to test for a binary operation for RHS as string literal.
 
template<typename ColumnName , typename T >
Derived & Where (ColumnName const &columnName, T const &value)
 Constructs or extends a WHERE clause to test for equality.
 
template<typename ColumnName , typename T >
Derived & OrWhere (ColumnName const &columnName, T const &value)
 Constructs or extends an WHERE/OR clause to test for equality.
 
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
Derived & Where (Callable const &callable)
 Constructs or extends a WHERE/AND clause to test for a group of values.
 
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
Derived & OrWhere (Callable const &callable)
 Constructs or extends an WHERE/OR clause to test for a group of values.
 
template<typename ColumnName , std::ranges::input_range InputRange>
Derived & WhereIn (ColumnName const &columnName, InputRange const &values)
 Constructs or extends an WHERE/OR clause to test for a value, satisfying std::ranges::input_range.
 
template<typename ColumnName , typename T >
Derived & WhereIn (ColumnName const &columnName, std::initializer_list< T > const &values)
 Constructs or extends an WHERE/OR clause to test for a value, satisfying std::initializer_list.
 
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
Derived & WhereIn (ColumnName const &columnName, SubSelectQuery const &subSelectQuery)
 Constructs or extends an WHERE/OR clause to test for a value, satisfying a sub-select query.
 
template<typename ColumnName >
Derived & WhereNull (ColumnName const &columnName)
 Constructs or extends an WHERE/OR clause to test for a value to be NULL.
 
template<typename ColumnName >
Derived & WhereNotNull (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being not null.
 
template<typename ColumnName , typename T >
Derived & WhereNotEqual (ColumnName const &columnName, T const &value)
 Constructs or extends a WHERE clause to test for a value being equal to another column.
 
template<typename ColumnName >
Derived & WhereTrue (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being true.
 
template<typename ColumnName >
Derived & WhereFalse (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being false.
 
Derived & InnerJoin (TableName auto joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn)
 
Derived & InnerJoin (TableName auto joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn)
 Constructs an INNER JOIN clause.
 
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & InnerJoin (TableName auto joinTable, OnChainCallable const &onClauseBuilder)
 
template<auto LeftField, auto RightField>
Derived & InnerJoin ()
 
Derived & LeftOuterJoin (TableName auto joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn)
 Constructs an LEFT OUTER JOIN clause.
 
Derived & LeftOuterJoin (TableName auto joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn)
 Constructs an LEFT OUTER JOIN clause.
 
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & LeftOuterJoin (TableName auto joinTable, OnChainCallable const &onClauseBuilder)
 
Derived & RightOuterJoin (TableName auto joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn)
 Constructs an RIGHT OUTER JOIN clause.
 
Derived & RightOuterJoin (TableName auto joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn)
 Constructs an RIGHT OUTER JOIN clause.
 
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & RightOuterJoin (TableName auto joinTable, OnChainCallable const &onClauseBuilder)
 
Derived & FullOuterJoin (TableName auto joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn)
 Constructs an FULL OUTER JOIN clause.
 
Derived & FullOuterJoin (TableName auto joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn)
 Constructs an FULL OUTER JOIN clause.
 
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & FullOuterJoin (TableName auto joinTable, OnChainCallable const &onClauseBuilder)
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Where (ColumnName const &columnName, T const &value)
 Constructs or extends a WHERE clause to test for equality.
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & OrWhere (ColumnName const &columnName, T const &value)
 Constructs or extends a WHERE/OR clause to test for equality.
 
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
LIGHTWEIGHT_FORCE_INLINE Derived & OrWhere (Callable const &callable)
 Constructs or extends a WHERE/OR clause to test for a group of values.
 
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
LIGHTWEIGHT_FORCE_INLINE Derived & Where (Callable const &callable)
 Constructs or extends a WHERE/AND clause to test for a group of values.
 
template<typename ColumnName , std::ranges::input_range InputRange>
LIGHTWEIGHT_FORCE_INLINE Derived & WhereIn (ColumnName const &columnName, InputRange const &values)
 Constructs or extends a WHERE IN clause with an input range.
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereIn (ColumnName const &columnName, std::initializer_list< T > const &values)
 Constructs or extends a WHERE IN clause with an initializer list.
 
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
LIGHTWEIGHT_FORCE_INLINE Derived & WhereIn (ColumnName const &columnName, SubSelectQuery const &subSelectQuery)
 Constructs or extends a WHERE IN clause with a sub-select query.
 
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereNotNull (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being not null.
 
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereNull (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being null.
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereNotEqual (ColumnName const &columnName, T const &value)
 Constructs or extends a WHERE clause to test for inequality.
 
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereTrue (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being true.
 
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereFalse (ColumnName const &columnName)
 Constructs or extends a WHERE clause to test for a value being false.
 
template<typename ColumnName , std::size_t N>
LIGHTWEIGHT_FORCE_INLINE Derived & Where (ColumnName const &columnName, std::string_view binaryOp, char const (&value)[N])
 Constructs or extends a WHERE clause with a string literal value.
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Where (ColumnName const &columnName, std::string_view binaryOp, T const &value)
 Constructs or extends a WHERE clause to test for a binary operation.
 
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
LIGHTWEIGHT_FORCE_INLINE Derived & Where (ColumnName const &columnName, std::string_view binaryOp, SubSelectQuery const &value)
 Constructs or extends a WHERE clause with a sub-select query.
 
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & OrWhere (ColumnName const &columnName, std::string_view binaryOp, T const &value)
 Constructs or extends a WHERE/OR clause with a binary operation.
 
template<typename T >
LIGHTWEIGHT_FORCE_INLINE auto If (std::optional< T > const &value) noexcept
 Starts a conditional WHERE chain gated by a std::optional value.
 
template<typename ColumnName >
requires (std::same_as<ColumnName, SqlQualifiedTableColumnName> || std::convertible_to<ColumnName, std::string_view> || std::convertible_to<ColumnName, std::string>)
LIGHTWEIGHT_FORCE_INLINE void AppendColumnName (ColumnName const &columnName)
 Appends a column name to the WHERE condition.
 
template<typename LiteralType >
LIGHTWEIGHT_FORCE_INLINE void AppendLiteralValue (LiteralType const &value)
 Appends a literal value to the WHERE condition.
 
template<typename LiteralType , typename TargetType >
LIGHTWEIGHT_FORCE_INLINE void PopulateLiteralValueInto (LiteralType const &value, TargetType &target)
 Populates a literal value into the target string.
 
template<typename Callable >
LIGHTWEIGHT_FORCE_INLINE Derived & Join (JoinType joinType, TableName auto joinTable, Callable const &onClauseBuilder)
 Constructs a JOIN clause with a custom ON clause builder.
 

Protected Member Functions

PendingConnective TakePendingConnective () noexcept
 
SqlQueryFormatter const & DerivedFormatter () const noexcept
 The formatter of the derived builder, which SqlWhereClauseBuilder does not own itself.
 

Detailed Description

template<typename Derived>
class Lightweight::SqlWhereClauseBuilder< Derived >

Helper CRTP-based class for building WHERE clauses.

This class is inherited by the SqlSelectQueryBuilder, SqlUpdateQueryBuilder, and SqlDeleteQueryBuilder

Definition at line 433 of file Core.hpp.

Member Function Documentation

◆ And()

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::And ( )
inlinenoexcept

Indicates, that the next WHERE clause should be AND-ed (default).

Definition at line 1144 of file Core.hpp.

◆ Or()

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Or ( )
inlinenoexcept

Indicates, that the next WHERE clause should be OR-ed.

Definition at line 1151 of file Core.hpp.

◆ Not()

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Not ( )
inlinenoexcept

Indicates, that the next WHERE clause should be negated.

Definition at line 1158 of file Core.hpp.

◆ WhereRaw()

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereRaw ( std::string_view  sqlConditionExpression)
inline

Constructs or extends a raw WHERE clause.

Definition at line 1565 of file Core.hpp.

◆ If() [1/2]

template<typename Derived >
template<typename T >
auto Lightweight::SqlWhereClauseBuilder< Derived >::If ( std::optional< T > const &  value)
noexcept

Starts a conditional WHERE chain driven by a std::optional<T> value.

The returned sub-builder exposes two ThenWhere overloads: ThenWhere(column) appends WHERE column = *value, and ThenWhere(column, binaryOp) appends WHERE column <binaryOp> *value (e.g. ">=", "<", "!="). Both overloads emit nothing when value is empty and return the underlying builder for further chaining.

The optional is captured by reference and must outlive the chain.

Template Parameters
TThe contained value type held by the optional.
Parameters
valueThe optional whose presence gates the conditional WHERE.
Returns
A sub-builder exposing ThenWhere(column) and ThenWhere(column, binaryOp).

Example:

std::optional<int> val { 42 };
builder.If(val).ThenWhere(FullyQualifiedNameOf<&Table::value>);
// Appends: WHERE "Table"."value" = 42
std::optional<SqlDateTime> since = ...;
builder.If(since).ThenWhere(FullyQualifiedNameOf<&Events::createdAt>, ">=");
// Appends: WHERE "Events"."createdAt" >= '2026-05-18T12:30:45.000' (when since holds a value)

◆ InnerJoin() [1/4]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::InnerJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
SqlQualifiedTableColumnName  onOtherColumn 
)
inline

Constructs an INNER JOIN clause.

Parameters
joinTableThe table's name to join with. This can be a string, a string_view, or an AliasedTableName.
joinColumnNameThe name of the column in the main table to join on.
onOtherColumnThe column in the join table to compare against.

Definition at line 1378 of file Core.hpp.

◆ InnerJoin() [2/4]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::InnerJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
std::string_view  onMainTableColumn 
)
inline

Constructs an INNER JOIN clause.

Definition at line 1386 of file Core.hpp.

◆ InnerJoin() [3/4]

template<typename Derived >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & Lightweight::SqlWhereClauseBuilder< Derived >::InnerJoin ( TableName auto  joinTable,
OnChainCallable const &  onClauseBuilder 
)

Constructs an INNER JOIN clause with a custom ON clause.

Parameters
joinTableThe table to join with: a string, a string_view, or an AliasedTableName. An aliased table renders as JOIN "table" AS "alias", and the ON-clause builder qualifies the joined table's columns with the alias, so the same table can be joined more than once under different aliases.
onClauseBuilderCalled with a SqlJoinConditionBuilder to compose the ON clause. If it adds no condition, the join is dropped from the query.
Returns
The query builder, for chaining.

Definition at line 1414 of file Core.hpp.

◆ InnerJoin() [4/4]

template<typename Derived >
template<auto LeftField, auto RightField>
Derived & Lightweight::SqlWhereClauseBuilder< Derived >::InnerJoin ( )

Constructs an INNER JOIN clause given two fields from different records using the field name as join column.

Template Parameters
LeftFieldThe field name to join on, such as JoinTestB::a_id, which will join on table JoinTestB with the column a_id to be compared against right field's column.
RightFieldThe other column to compare and join against.

Example:

InnerJoin<&JoinTestB::a_id, &JoinTestA::id>()
// This will generate a INNER JOIN "JoinTestB" ON "InnerTestB"."a_id" = "JoinTestA"."id"

Definition at line 1395 of file Core.hpp.

References Lightweight::RecordTableName.

◆ LeftOuterJoin() [1/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::LeftOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
SqlQualifiedTableColumnName  onOtherColumn 
)
inline

Constructs an LEFT OUTER JOIN clause.

Definition at line 1420 of file Core.hpp.

◆ LeftOuterJoin() [2/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::LeftOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
std::string_view  onMainTableColumn 
)
inline

Constructs an LEFT OUTER JOIN clause.

Definition at line 1427 of file Core.hpp.

◆ LeftOuterJoin() [3/3]

template<typename Derived >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & Lightweight::SqlWhereClauseBuilder< Derived >::LeftOuterJoin ( TableName auto  joinTable,
OnChainCallable const &  onClauseBuilder 
)

Constructs a LEFT OUTER JOIN clause with a custom ON clause.

Parameters
joinTableThe table to join with: a string, a string_view, or an AliasedTableName. An aliased table renders as JOIN "table" AS "alias", and the ON-clause builder qualifies the joined table's columns with the alias, so the same table can be joined more than once under different aliases.
onClauseBuilderCalled with a SqlJoinConditionBuilder to compose the ON clause. If it adds no condition, the join is dropped from the query.
Returns
The query builder, for chaining.

Definition at line 1437 of file Core.hpp.

◆ RightOuterJoin() [1/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::RightOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
SqlQualifiedTableColumnName  onOtherColumn 
)
inline

Constructs an RIGHT OUTER JOIN clause.

Definition at line 1443 of file Core.hpp.

◆ RightOuterJoin() [2/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::RightOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
std::string_view  onMainTableColumn 
)
inline

Constructs an RIGHT OUTER JOIN clause.

Definition at line 1450 of file Core.hpp.

◆ RightOuterJoin() [3/3]

template<typename Derived >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & Lightweight::SqlWhereClauseBuilder< Derived >::RightOuterJoin ( TableName auto  joinTable,
OnChainCallable const &  onClauseBuilder 
)

Constructs a RIGHT OUTER JOIN clause with a custom ON clause.

Parameters
joinTableThe table to join with: a string, a string_view, or an AliasedTableName. An aliased table renders as JOIN "table" AS "alias", and the ON-clause builder qualifies the joined table's columns with the alias, so the same table can be joined more than once under different aliases.
onClauseBuilderCalled with a SqlJoinConditionBuilder to compose the ON clause. If it adds no condition, the join is dropped from the query.
Returns
The query builder, for chaining.

Definition at line 1460 of file Core.hpp.

◆ FullOuterJoin() [1/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::FullOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
SqlQualifiedTableColumnName  onOtherColumn 
)
inline

Constructs an FULL OUTER JOIN clause.

Definition at line 1466 of file Core.hpp.

◆ FullOuterJoin() [2/3]

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::FullOuterJoin ( TableName auto  joinTable,
std::string_view  joinColumnName,
std::string_view  onMainTableColumn 
)
inline

Constructs an FULL OUTER JOIN clause.

Definition at line 1473 of file Core.hpp.

◆ FullOuterJoin() [3/3]

template<typename Derived >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
template<typename OnChainCallable >
requires std::invocable<OnChainCallable, SqlJoinConditionBuilder>
Derived & Lightweight::SqlWhereClauseBuilder< Derived >::FullOuterJoin ( TableName auto  joinTable,
OnChainCallable const &  onClauseBuilder 
)

Constructs a FULL OUTER JOIN clause with a custom ON clause.

Parameters
joinTableThe table to join with: a string, a string_view, or an AliasedTableName. An aliased table renders as JOIN "table" AS "alias", and the ON-clause builder qualifies the joined table's columns with the alias, so the same table can be joined more than once under different aliases.
onClauseBuilderCalled with a SqlJoinConditionBuilder to compose the ON clause. If it adds no condition, the join is dropped from the query.
Returns
The query builder, for chaining.

Definition at line 1483 of file Core.hpp.

◆ TakePendingConnective()

template<typename Derived >
auto Lightweight::SqlWhereClauseBuilder< Derived >::TakePendingConnective ( )
inlineprotectednoexcept

Hands a pending And(), Or() or Not() over to a term of the HAVING clause.

They are called on the shared builder, so they cannot tell which clause they are for. Leaving them behind would make the next Where() begin with AND or OR rather than WHERE.

Returns
The connective requested; the WHERE clause continues as though it had not been asked.

Definition at line 1576 of file Core.hpp.

References Lightweight::SqlWhereClauseBuilder< Derived >::PendingConnective::isOr.

◆ DerivedFormatter()

template<typename Derived >
LIGHTWEIGHT_FORCE_INLINE SqlQueryFormatter const & Lightweight::SqlWhereClauseBuilder< Derived >::DerivedFormatter ( ) const
inlineprotectednoexcept

The formatter of the derived builder, which SqlWhereClauseBuilder does not own itself.

Definition at line 1594 of file Core.hpp.

◆ Where() [1/5]

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Where ( ColumnName const &  columnName,
T const &  value 
)
inline

Constructs or extends a WHERE clause to test for equality.

Definition at line 1167 of file Core.hpp.

◆ OrWhere() [1/3]

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::OrWhere ( ColumnName const &  columnName,
T const &  value 
)
inline

Constructs or extends a WHERE/OR clause to test for equality.

Definition at line 1186 of file Core.hpp.

◆ OrWhere() [2/3]

template<typename Derived >
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::OrWhere ( Callable const &  callable)
inline

Constructs or extends a WHERE/OR clause to test for a group of values.

Definition at line 1196 of file Core.hpp.

◆ Where() [2/5]

template<typename Derived >
template<typename Callable >
requires std::invocable<Callable, SqlWhereClauseBuilder<Derived>&>
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Where ( Callable const &  callable)
inline

Constructs or extends a WHERE/AND clause to test for a group of values.

Definition at line 1205 of file Core.hpp.

◆ WhereIn() [1/3]

template<typename Derived >
template<typename ColumnName , std::ranges::input_range InputRange>
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereIn ( ColumnName const &  columnName,
InputRange const &  values 
)
inline

Constructs or extends a WHERE IN clause with an input range.

Definition at line 1230 of file Core.hpp.

◆ WhereIn() [2/3]

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereIn ( ColumnName const &  columnName,
std::initializer_list< T > const &  values 
)
inline

Constructs or extends a WHERE IN clause with an initializer list.

Definition at line 1246 of file Core.hpp.

◆ WhereIn() [3/3]

template<typename Derived >
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereIn ( ColumnName const &  columnName,
SubSelectQuery const &  subSelectQuery 
)
inline

Constructs or extends a WHERE IN clause with a sub-select query.

Definition at line 1259 of file Core.hpp.

◆ WhereNotNull()

template<typename Derived >
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereNotNull ( ColumnName const &  columnName)
inline

Constructs or extends a WHERE clause to test for a value being not null.

Definition at line 1268 of file Core.hpp.

◆ WhereNull()

template<typename Derived >
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereNull ( ColumnName const &  columnName)
inline

Constructs or extends a WHERE clause to test for a value being null.

Definition at line 1276 of file Core.hpp.

◆ WhereNotEqual()

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereNotEqual ( ColumnName const &  columnName,
T const &  value 
)
inline

Constructs or extends a WHERE clause to test for inequality.

Definition at line 1284 of file Core.hpp.

◆ WhereTrue()

template<typename Derived >
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereTrue ( ColumnName const &  columnName)
inline

Constructs or extends a WHERE clause to test for a value being true.

Definition at line 1296 of file Core.hpp.

◆ WhereFalse()

template<typename Derived >
template<typename ColumnName >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereFalse ( ColumnName const &  columnName)
inline

Constructs or extends a WHERE clause to test for a value being false.

Definition at line 1304 of file Core.hpp.

◆ Where() [3/5]

template<typename Derived >
template<typename ColumnName , std::size_t N>
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Where ( ColumnName const &  columnName,
std::string_view  binaryOp,
char const (&)  value[N] 
)
inline

Constructs or extends a WHERE clause with a string literal value.

Definition at line 1330 of file Core.hpp.

◆ Where() [4/5]

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Where ( ColumnName const &  columnName,
std::string_view  binaryOp,
T const &  value 
)
inline

Constructs or extends a WHERE clause to test for a binary operation.

Definition at line 1340 of file Core.hpp.

◆ Where() [5/5]

template<typename Derived >
template<typename ColumnName , typename SubSelectQuery >
requires (std::is_invocable_r_v<std::string, decltype(&SubSelectQuery::ToSql), SubSelectQuery const&>)
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Where ( ColumnName const &  columnName,
std::string_view  binaryOp,
SubSelectQuery const &  value 
)
inline

Constructs or extends a WHERE clause with a sub-select query.

Definition at line 1360 of file Core.hpp.

◆ OrWhere() [3/3]

template<typename Derived >
template<typename ColumnName , typename T >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::OrWhere ( ColumnName const &  columnName,
std::string_view  binaryOp,
T const &  value 
)
inline

Constructs or extends a WHERE/OR clause with a binary operation.

Definition at line 1370 of file Core.hpp.

References Lightweight::SqlWhereClauseBuilder< Derived >::Where().

◆ If() [2/2]

template<typename Derived >
template<typename T >
LIGHTWEIGHT_FORCE_INLINE auto Lightweight::SqlWhereClauseBuilder< Derived >::If ( std::optional< T > const &  value)
inlinenoexcept

Starts a conditional WHERE chain gated by a std::optional value.

Definition at line 1559 of file Core.hpp.

◆ AppendColumnName()

template<typename Derived >
template<typename ColumnName >
requires (std::same_as<ColumnName, SqlQualifiedTableColumnName> || std::convertible_to<ColumnName, std::string_view> || std::convertible_to<ColumnName, std::string>)
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlWhereClauseBuilder< Derived >::AppendColumnName ( ColumnName const &  columnName)
inline

Appends a column name to the WHERE condition.

Definition at line 1635 of file Core.hpp.

◆ AppendLiteralValue()

template<typename Derived >
template<typename LiteralType >
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlWhereClauseBuilder< Derived >::AppendLiteralValue ( LiteralType const &  value)
inline

Appends a literal value to the WHERE condition.

Definition at line 1643 of file Core.hpp.

◆ PopulateLiteralValueInto()

template<typename Derived >
template<typename LiteralType , typename TargetType >
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlWhereClauseBuilder< Derived >::PopulateLiteralValueInto ( LiteralType const &  value,
TargetType &  target 
)
inline

Populates a literal value into the target string.

Definition at line 1731 of file Core.hpp.

◆ Join()

template<typename Derived >
template<typename Callable >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::Join ( JoinType  joinType,
TableName auto  joinTable,
Callable const &  onClauseBuilder 
)
inline

Constructs a JOIN clause with a custom ON clause builder.

Definition at line 1870 of file Core.hpp.


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