mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-06 09:30:07 -06:00
Started developing conditions
This commit is contained in:
15
include/sqlgen/dynamic/ColumnOrValue.hpp
Normal file
15
include/sqlgen/dynamic/ColumnOrValue.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef SQLGEN_DYNAMIC_COLUMNORVALUE_HPP_
|
||||
#define SQLGEN_DYNAMIC_COLUMNORVALUE_HPP_
|
||||
|
||||
#include <rfl.hpp>
|
||||
|
||||
#include "Column.hpp"
|
||||
#include "Value.hpp"
|
||||
|
||||
namespace sqlgen::dynamic {
|
||||
|
||||
using ColumnOrValue = rfl::TaggedUnion<"type", Column, Value>;
|
||||
|
||||
} // namespace sqlgen::dynamic
|
||||
|
||||
#endif
|
||||
64
include/sqlgen/dynamic/Condition.hpp
Normal file
64
include/sqlgen/dynamic/Condition.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef SQLGEN_DYNAMIC_CONDITION_HPP_
|
||||
#define SQLGEN_DYNAMIC_CONDITION_HPP_
|
||||
|
||||
#include <rfl.hpp>
|
||||
|
||||
#include "../Ref.hpp"
|
||||
#include "Column.hpp"
|
||||
#include "ColumnOrValue.hpp"
|
||||
|
||||
namespace sqlgen::dynamic {
|
||||
|
||||
struct Condition {
|
||||
struct And {
|
||||
Ref<Condition> op1;
|
||||
Ref<Condition> op2;
|
||||
};
|
||||
|
||||
struct Equals {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct GreaterEqual {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct GreaterThan {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct NotEquals {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct LesserEqual {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct LesserThan {
|
||||
Column op1;
|
||||
ColumnOrValue op2;
|
||||
};
|
||||
|
||||
struct Or {
|
||||
Ref<Condition> op1;
|
||||
Ref<Condition> op2;
|
||||
};
|
||||
|
||||
using ReflectionType =
|
||||
rfl::TaggedUnion<"what", And, Equals, GreaterEqual, GreaterThan,
|
||||
NotEquals, LesserEqual, LesserThan, Or>;
|
||||
|
||||
ReflectionType reflection() const { return val; }
|
||||
|
||||
ReflectionType val;
|
||||
};
|
||||
|
||||
} // namespace sqlgen::dynamic
|
||||
|
||||
#endif
|
||||
25
include/sqlgen/dynamic/Value.hpp
Normal file
25
include/sqlgen/dynamic/Value.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef SQLGEN_DYNAMIC_VALUE_HPP_
|
||||
#define SQLGEN_DYNAMIC_VALUE_HPP_
|
||||
|
||||
#include <rfl.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace sqlgen::dynamic {
|
||||
|
||||
struct Float {
|
||||
double val;
|
||||
};
|
||||
|
||||
struct Integer {
|
||||
int64_t val;
|
||||
};
|
||||
|
||||
struct String {
|
||||
std::string val;
|
||||
};
|
||||
|
||||
using Value = rfl::TaggedUnion<"type", Float, Integer, String>;
|
||||
|
||||
} // namespace sqlgen::dynamic
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user