relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
arithmetic.hpp File Reference
#include "column_expression.hpp"
#include "core.hpp"
#include "operators.hpp"
#include "schema_adapter.hpp"
#include "value.hpp"
#include <type_traits>

Go to the source code of this file.

Classes

struct  relx::query::arithmetic_checking::extract_arithmetic_type< T >
 Helper to extract column type for arithmetic checking. More...
 
struct  relx::query::arithmetic_checking::extract_arithmetic_type< schema::column< TableT, Name, ColumnT, Modifiers... > >
 
struct  relx::query::arithmetic_checking::remove_optional< T >
 Helper to extract base type from optional. More...
 
struct  relx::query::arithmetic_checking::remove_optional< std::optional< T > >
 
class  relx::query::ArithmeticExpr< Left, Right >
 Binary arithmetic expression. More...
 

Namespaces

namespace  relx
 relx database connection
 
namespace  relx::query
 
namespace  relx::query::arithmetic_checking
 Type checking for arithmetic operations.
 
namespace  relx::schema
 

Concepts

concept  relx::query::arithmetic_checking::Arithmetic
 Concept for numeric types suitable for arithmetic operations.
 

Typedefs

template<typename T >
using relx::query::arithmetic_checking::extract_arithmetic_type_t = typename extract_arithmetic_type< T >::type
 
template<typename T >
using relx::query::arithmetic_checking::remove_optional_t = typename remove_optional< T >::type
 

Functions

template<typename TableT1 , schema::fixed_string Name1, typename T1 , typename... Modifiers1, typename TableT2 , schema::fixed_string Name2, typename T2 , typename... Modifiers2>
auto relx::query::operator+ (const schema::column< TableT1, Name1, T1, Modifiers1... > &left, const schema::column< TableT2, Name2, T2, Modifiers2... > &right)
 Addition operator for columns with type checking.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator+ (const schema::column< TableT, Name, T, Modifiers... > &left, ValueT &&value)
 Addition operator for column with value.
 
template<typename ValueT , typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator+ (ValueT &&value, const schema::column< TableT, Name, T, Modifiers... > &right)
 Addition operator for value with column (reversed)
 
template<typename TableT1 , schema::fixed_string Name1, typename T1 , typename... Modifiers1, typename TableT2 , schema::fixed_string Name2, typename T2 , typename... Modifiers2>
auto relx::query::operator- (const schema::column< TableT1, Name1, T1, Modifiers1... > &left, const schema::column< TableT2, Name2, T2, Modifiers2... > &right)
 Subtraction operator for columns.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator- (const schema::column< TableT, Name, T, Modifiers... > &left, ValueT &&value)
 Subtraction operator for column with value.
 
template<typename ValueT , typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator- (ValueT &&value, const schema::column< TableT, Name, T, Modifiers... > &right)
 Subtraction operator for value with column (reversed)
 
template<typename TableT1 , schema::fixed_string Name1, typename T1 , typename... Modifiers1, typename TableT2 , schema::fixed_string Name2, typename T2 , typename... Modifiers2>
auto relx::query::operator* (const schema::column< TableT1, Name1, T1, Modifiers1... > &left, const schema::column< TableT2, Name2, T2, Modifiers2... > &right)
 Multiplication operator for columns.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator* (const schema::column< TableT, Name, T, Modifiers... > &left, ValueT &&value)
 Multiplication operator for column with value.
 
template<typename ValueT , typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator* (ValueT &&value, const schema::column< TableT, Name, T, Modifiers... > &right)
 Multiplication operator for value with column (reversed)
 
template<typename TableT1 , schema::fixed_string Name1, typename T1 , typename... Modifiers1, typename TableT2 , schema::fixed_string Name2, typename T2 , typename... Modifiers2>
auto relx::query::operator/ (const schema::column< TableT1, Name1, T1, Modifiers1... > &left, const schema::column< TableT2, Name2, T2, Modifiers2... > &right)
 Division operator for columns.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator/ (const schema::column< TableT, Name, T, Modifiers... > &left, ValueT &&value)
 Division operator for column with value.
 
template<typename ValueT , typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator/ (ValueT &&value, const schema::column< TableT, Name, T, Modifiers... > &right)
 Division operator for value with column (reversed)
 
template<SqlExpr Left, SqlExpr Right, typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
auto relx::query::operator+ (const ArithmeticExpr< Left, Right > &left_expr, const schema::column< TableT, Name, T, Modifiers... > &right)
 Addition operator for ArithmeticExpr with column.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, SqlExpr Left, SqlExpr Right>
auto relx::query::operator+ (const schema::column< TableT, Name, T, Modifiers... > &left, const ArithmeticExpr< Left, Right > &right_expr)
 Addition operator for column with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator+ (const ArithmeticExpr< Left, Right > &left_expr, ValueT &&value)
 Addition operator for ArithmeticExpr with value.
 
template<typename ValueT , SqlExpr Left, SqlExpr Right>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator+ (ValueT &&value, const ArithmeticExpr< Left, Right > &right_expr)
 Addition operator for value with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
auto relx::query::operator- (const ArithmeticExpr< Left, Right > &left_expr, const schema::column< TableT, Name, T, Modifiers... > &right)
 Subtraction operator for ArithmeticExpr with column.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, SqlExpr Left, SqlExpr Right>
auto relx::query::operator- (const schema::column< TableT, Name, T, Modifiers... > &left, const ArithmeticExpr< Left, Right > &right_expr)
 Subtraction operator for column with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator- (const ArithmeticExpr< Left, Right > &left_expr, ValueT &&value)
 Subtraction operator for ArithmeticExpr with value.
 
template<typename ValueT , SqlExpr Left, SqlExpr Right>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator- (ValueT &&value, const ArithmeticExpr< Left, Right > &right_expr)
 Subtraction operator for value with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
auto relx::query::operator* (const ArithmeticExpr< Left, Right > &left_expr, const schema::column< TableT, Name, T, Modifiers... > &right)
 Multiplication operator for ArithmeticExpr with column.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, SqlExpr Left, SqlExpr Right>
auto relx::query::operator* (const schema::column< TableT, Name, T, Modifiers... > &left, const ArithmeticExpr< Left, Right > &right_expr)
 Multiplication operator for column with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator* (const ArithmeticExpr< Left, Right > &left_expr, ValueT &&value)
 Multiplication operator for ArithmeticExpr with value.
 
template<typename ValueT , SqlExpr Left, SqlExpr Right>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator* (ValueT &&value, const ArithmeticExpr< Left, Right > &right_expr)
 Multiplication operator for value with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename TableT , schema::fixed_string Name, typename T , typename... Modifiers>
auto relx::query::operator/ (const ArithmeticExpr< Left, Right > &left_expr, const schema::column< TableT, Name, T, Modifiers... > &right)
 Division operator for ArithmeticExpr with column.
 
template<typename TableT , schema::fixed_string Name, typename T , typename... Modifiers, SqlExpr Left, SqlExpr Right>
auto relx::query::operator/ (const schema::column< TableT, Name, T, Modifiers... > &left, const ArithmeticExpr< Left, Right > &right_expr)
 Division operator for column with ArithmeticExpr.
 
template<SqlExpr Left, SqlExpr Right, typename ValueT >
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator/ (const ArithmeticExpr< Left, Right > &left_expr, ValueT &&value)
 Division operator for ArithmeticExpr with value.
 
template<typename ValueT , SqlExpr Left, SqlExpr Right>
requires std::is_arithmetic_v<std::remove_cvref_t<ValueT>>
auto relx::query::operator/ (ValueT &&value, const query::ArithmeticExpr< Left, Right > &right_expr)
 Division operator for value with ArithmeticExpr.
 

Variables

constexpr std::string_view relx::query::arithmetic_checking::arithmetic_error_message
 Error message for invalid arithmetic operations.