added like and between operator
This commit is contained in:
@@ -15,6 +15,8 @@ SET(SOURCE
|
||||
condition/logical_condition_node.cpp
|
||||
../include/matador/condition/between_condition_node.hpp
|
||||
condition/between_condition_node.cpp
|
||||
../include/matador/condition/like_condition_node.hpp
|
||||
condition/like_condition_node.cpp
|
||||
)
|
||||
|
||||
add_library(matador-condition STATIC ${SOURCE})
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "matador/condition/condition_operators.hpp"
|
||||
|
||||
#include "matador/condition/between_condition_node.hpp"
|
||||
#include "matador/condition/like_condition_node.hpp"
|
||||
#include "matador/condition/logical_condition_node.hpp"
|
||||
#include "matador/condition/not_condition_node.hpp"
|
||||
|
||||
@@ -16,4 +18,11 @@ condition_node_ptr operator!(condition_node_ptr cond) {
|
||||
return std::make_unique<not_condition_node>(std::move(cond));
|
||||
}
|
||||
|
||||
}
|
||||
condition_node_ptr between(const column &col, value min, value max) {
|
||||
return std::make_unique<between_condition_node>(col, std::move(min), std::move(max));
|
||||
}
|
||||
|
||||
condition_node_ptr like(const column &col, const std::string &pattern) {
|
||||
return std::make_unique<like_condition_node>(col, pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "matador/condition/like_condition_node.hpp"
|
||||
|
||||
#include "matador/condition/condition_node_visitor.hpp"
|
||||
|
||||
namespace matador::condition {
|
||||
like_condition_node::like_condition_node(column column, std::string pattern)
|
||||
: column_(std::move(column))
|
||||
, pattern_(std::move(pattern)){}
|
||||
|
||||
void like_condition_node::accept(condition_node_visitor &visitor) const {
|
||||
visitor.visit(*this);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ int main() {
|
||||
cond = "age"_col <= 7;
|
||||
cond = in("age"_col, {34, 35, 78});
|
||||
cond = out("age"_col, {34, 35, 78});
|
||||
cond = between("age"_col, 34, 78);
|
||||
cond = like("name"_col, "John");
|
||||
|
||||
|
||||
// "age"_col != 7 && in("age"_col, {7,5,5,8});
|
||||
|
||||
Reference in New Issue
Block a user