relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
function.hpp File Reference
#include "column_expression.hpp"
#include "core.hpp"
#include "value.hpp"
#include <iostream>
#include <memory>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  relx::query::FunctionExpr< Expr >
 Base class for SQL function expressions. More...
 
class  relx::query::NullaryFunctionExpr
 Base class for SQL function expressions with no arguments. More...
 
class  relx::query::CountAllExpr
 Expression representing COUNT(*) in SQL. More...
 
struct  relx::query::aggregate_checking::extract_column_type< T >
 Helper to extract column type for checking. More...
 
struct  relx::query::aggregate_checking::extract_column_type< schema::column< TableT, Name, ColumnT, Modifiers... > >
 
class  relx::query::DistinctExpr< Expr >
 DISTINCT qualifier for an expression. More...
 
class  relx::query::CoalesceExpr< First, Second, Rest >
 COALESCE function. More...
 
class  relx::query::CaseExpr
 
class  relx::query::TypedCaseBuilder< ResultType >
 

Namespaces

namespace  relx
 relx database connection
 
namespace  relx::query
 
namespace  relx::query::aggregate_checking
 Type checking concepts for aggregate functions.
 

Concepts

concept  relx::query::aggregate_checking::Summable
 Concept for numeric types suitable for SUM and AVG.
 
concept  relx::query::aggregate_checking::Countable
 Concept for types suitable for COUNT (any type is countable)
 
concept  relx::query::aggregate_checking::Comparable
 Concept for comparable types suitable for MIN/MAX.
 

Typedefs

template<typename T >
using relx::query::aggregate_checking::extract_column_type_t = typename extract_column_type< T >::type
 
using relx::query::CaseBuilder = TypedCaseBuilder< void >
 

Functions

auto relx::query::count_all ()
 COUNT(*) aggregate function.
 
template<SqlExpr Expr>
auto relx::query::count (Expr expr)
 COUNT aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::count (const T &column)
 
template<SqlExpr Expr>
auto relx::query::count_distinct (Expr expr)
 COUNT(DISTINCT expr) aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::count_distinct (const T &column)
 
template<SqlExpr Expr>
auto relx::query::sum (Expr expr)
 SUM aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::sum (const T &column)
 
template<SqlExpr Expr>
auto relx::query::avg (Expr expr)
 AVG aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::avg (const T &column)
 
template<SqlExpr Expr>
auto relx::query::min (Expr expr)
 MIN aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::min (const T &column)
 
template<SqlExpr Expr>
auto relx::query::max (Expr expr)
 MAX aggregate function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::max (const T &column)
 
template<SqlExpr Expr>
auto relx::query::distinct (Expr expr)
 Create a DISTINCT expression.
 
template<typename T >
requires ColumnType<T>
auto relx::query::distinct (const T &column)
 
template<SqlExpr Expr>
auto relx::query::lower (Expr expr)
 LOWER string function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::lower (const T &column)
 
template<SqlExpr Expr>
auto relx::query::upper (Expr expr)
 UPPER string function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::upper (const T &column)
 
template<SqlExpr Expr>
auto relx::query::length (Expr expr)
 LENGTH string function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::length (const T &column)
 
template<SqlExpr Expr>
auto relx::query::trim (Expr expr)
 TRIM string function.
 
template<typename T >
requires ColumnType<T>
auto relx::query::trim (const T &column)
 
template<SqlExpr First, SqlExpr Second, SqlExpr... Rest>
auto relx::query::coalesce (First first, Second second, Rest... rest)
 Create a COALESCE expression.
 
template<typename T , SqlExpr Second, SqlExpr... Rest>
requires ColumnType<T>
auto relx::query::coalesce (const T &column, Second second, Rest... rest)
 
template<typename T1 , typename T2 , SqlExpr... Rest>
requires ColumnType<T1> && ColumnType<T2>
auto relx::query::coalesce (const T1 &column1, const T2 &column2, Rest... rest)
 
template<typename T >
requires ColumnType<T>
auto relx::query::coalesce (const T &column, const char *str)
 
template<typename T >
requires ColumnType<T>
auto relx::query::coalesce (const T &column, const std::string &str)
 
template<typename T1 , typename T2 >
requires ColumnType<T1> && ColumnType<T2>
auto relx::query::coalesce (const T1 &column1, const T2 &column2, const char *str)
 
auto relx::query::case_ ()
 Create a CASE expression with type checking.
 
auto relx::query::as (CaseExpr &&expr, std::string alias)