renamed binary_operator to be pascal case
This commit is contained in:
parent
68d67b17b7
commit
bd06034ebf
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
namespace matador::query {
|
namespace matador::query {
|
||||||
enum class binary_operator {
|
enum class binary_operator {
|
||||||
EQUALS,
|
Equals,
|
||||||
NOT_EQUALS,
|
NotEquals,
|
||||||
GREATER_THAN,
|
GreaterThan,
|
||||||
GREATER_THAN_OR_EQUAL,
|
GreaterThanOrEqual,
|
||||||
LESS_THAN,
|
LessThan,
|
||||||
LESS_THAN_OR_EQUAL,
|
LessThanOrEqual,
|
||||||
};
|
};
|
||||||
|
|
||||||
class binary_criteria final : public abstract_column_criteria {
|
class binary_criteria final : public abstract_column_criteria {
|
||||||
|
|
|
||||||
|
|
@ -20,33 +20,33 @@ class table_column;
|
||||||
template<class Type>
|
template<class Type>
|
||||||
std::enable_if_t<!std::is_base_of_v<fetchable_query, std::decay_t<Type>>, criteria_ptr>
|
std::enable_if_t<!std::is_base_of_v<fetchable_query, std::decay_t<Type>>, criteria_ptr>
|
||||||
operator==(const table_column &col, Type val) {
|
operator==(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::EQUALS, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::Equals, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
std::enable_if_t<!std::is_base_of_v<fetchable_query, std::decay_t<Type>>, criteria_ptr>
|
std::enable_if_t<!std::is_base_of_v<fetchable_query, std::decay_t<Type>>, criteria_ptr>
|
||||||
operator!=(const table_column &col, Type val) {
|
operator!=(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::NOT_EQUALS, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::NotEquals, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
criteria_ptr operator>(const table_column &col, Type val) {
|
criteria_ptr operator>(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::GREATER_THAN, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::GreaterThan, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
criteria_ptr operator>=(const table_column &col, Type val) {
|
criteria_ptr operator>=(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::GREATER_THAN_OR_EQUAL, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::GreaterThanOrEqual, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
criteria_ptr operator<(const table_column &col, Type val) {
|
criteria_ptr operator<(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::LESS_THAN, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::LessThan, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
criteria_ptr operator<=(const table_column &col, Type val) {
|
criteria_ptr operator<=(const table_column &col, Type val) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::LESS_THAN_OR_EQUAL, utils::value(val));
|
return std::make_unique<binary_criteria>(col, binary_operator::LessThanOrEqual, utils::value(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator==(const table_column &col_left, const table_column &col_right);
|
criteria_ptr operator==(const table_column &col_left, const table_column &col_right);
|
||||||
|
|
|
||||||
|
|
@ -13,61 +13,61 @@ namespace matador::query {
|
||||||
criteria_ptr operator==(const table_column &col, const utils::identifier &id) {
|
criteria_ptr operator==(const table_column &col, const utils::identifier &id) {
|
||||||
utils::identifier_to_value_converter conv;
|
utils::identifier_to_value_converter conv;
|
||||||
|
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::EQUALS, conv.convert(id));
|
return std::make_unique<binary_criteria>(col, binary_operator::Equals, conv.convert(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator!=(const table_column &col, const utils::identifier &id) {
|
criteria_ptr operator!=(const table_column &col, const utils::identifier &id) {
|
||||||
utils::identifier_to_value_converter conv;
|
utils::identifier_to_value_converter conv;
|
||||||
|
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::NOT_EQUALS, conv.convert(id));
|
return std::make_unique<binary_criteria>(col, binary_operator::NotEquals, conv.convert(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator==(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator==(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::EQUALS, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::Equals, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator!=(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator!=(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::NOT_EQUALS, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::NotEquals, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator>(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator>(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::GREATER_THAN, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::GreaterThan, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator>=(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator>=(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::GREATER_THAN_OR_EQUAL, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::GreaterThanOrEqual, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator<(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator<(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::LESS_THAN, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::LessThan, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator<=(const table_column &col, utils::placeholder p) {
|
criteria_ptr operator<=(const table_column &col, utils::placeholder p) {
|
||||||
return std::make_unique<binary_criteria>(col, binary_operator::LESS_THAN_OR_EQUAL, p);
|
return std::make_unique<binary_criteria>(col, binary_operator::LessThanOrEqual, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator==( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator==( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::EQUALS, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::Equals, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator!=( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator!=( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::NOT_EQUALS, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::NotEquals, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator>( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator>( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::GREATER_THAN, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::GreaterThan, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator>=( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator>=( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::GREATER_THAN_OR_EQUAL, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::GreaterThanOrEqual, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator<( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator<( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::LESS_THAN, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::LessThan, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator<=( const table_column& col_left, const table_column& col_right ) {
|
criteria_ptr operator<=( const table_column& col_left, const table_column& col_right ) {
|
||||||
return std::make_unique<binary_column_criteria>(col_left, binary_operator::LESS_THAN_OR_EQUAL, col_right);
|
return std::make_unique<binary_column_criteria>(col_left, binary_operator::LessThanOrEqual, col_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria_ptr operator&&(criteria_ptr left, criteria_ptr right) {
|
criteria_ptr operator&&(criteria_ptr left, criteria_ptr right) {
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@
|
||||||
namespace matador::query {
|
namespace matador::query {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
static const utils::enum_mapper<binary_operator> BinaryOperatorEnum({
|
static const utils::enum_mapper<binary_operator> BinaryOperatorEnum({
|
||||||
{binary_operator::EQUALS, "="},
|
{binary_operator::Equals, "="},
|
||||||
{binary_operator::NOT_EQUALS, "<>"},
|
{binary_operator::NotEquals, "<>"},
|
||||||
{binary_operator::GREATER_THAN, ">"},
|
{binary_operator::GreaterThan, ">"},
|
||||||
{binary_operator::GREATER_THAN_OR_EQUAL, ">="},
|
{binary_operator::GreaterThanOrEqual, ">="},
|
||||||
{binary_operator::LESS_THAN, "<"},
|
{binary_operator::LessThan, "<"},
|
||||||
{binary_operator::LESS_THAN_OR_EQUAL, "<="},
|
{binary_operator::LessThanOrEqual, "<="},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ void select_query_builder::append_join(const table_column &left, const table_col
|
||||||
using namespace matador::query;
|
using namespace matador::query;
|
||||||
entity_query_data_.joins.push_back({
|
entity_query_data_.joins.push_back({
|
||||||
right.table(),
|
right.table(),
|
||||||
std::make_unique<binary_column_criteria>(left, binary_operator::EQUALS, right)
|
std::make_unique<binary_column_criteria>(left, binary_operator::Equals, right)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue