Lightweight 0.20260617.0
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 >.

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.
 
template<typename LeftColumn , typename RightColumn >
Derived & WhereColumn (LeftColumn const &left, std::string_view binaryOp, RightColumn const &right)
 Construts or extends a WHERE clause to test for a binary operation between two columns.
 
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)
 Constructs an INNER JOIN clause with a custom ON clause.
 
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)
 Constructs an LEFT OUTER JOIN clause with a custom ON clause.
 
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)
 Constructs an RIGHT OUTER JOIN clause with a custom ON clause.
 
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)
 Constructs an FULL OUTER JOIN clause with a custom ON clause.
 
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 LeftColumn , typename RightColumn >
LIGHTWEIGHT_FORCE_INLINE Derived & WhereColumn (LeftColumn const &left, std::string_view binaryOp, RightColumn const &right)
 Constructs or extends a WHERE clause to compare two columns.
 
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.
 

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 199 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 602 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 609 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 616 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 1024 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 837 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 845 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.

Definition at line 873 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 854 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 879 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 886 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 an LEFT OUTER JOIN clause with a custom ON clause.

Definition at line 896 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 902 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 909 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 an RIGHT OUTER JOIN clause with a custom ON clause.

Definition at line 919 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 925 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 932 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 an FULL OUTER JOIN clause with a custom ON clause.

Definition at line 942 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 625 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 644 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 654 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 663 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 688 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 699 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 711 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 720 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 728 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 736 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 748 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 756 of file Core.hpp.

◆ WhereColumn()

template<typename Derived >
template<typename LeftColumn , typename RightColumn >
LIGHTWEIGHT_FORCE_INLINE Derived & Lightweight::SqlWhereClauseBuilder< Derived >::WhereColumn ( LeftColumn const &  left,
std::string_view  binaryOp,
RightColumn const &  right 
)
inline

Constructs or extends a WHERE clause to compare two columns.

Definition at line 764 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 789 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 799 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 819 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 829 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 1018 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 1082 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 1090 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 1122 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 1238 of file Core.hpp.


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