mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-02 23:49:46 -06:00
committed by
GitHub
parent
15108fba46
commit
91e993ffdd
@@ -4,7 +4,6 @@
|
||||
#include <rfl.hpp>
|
||||
|
||||
#include "../Ref.hpp"
|
||||
#include "Column.hpp"
|
||||
#include "ColumnOrValue.hpp"
|
||||
#include "Operation.hpp"
|
||||
|
||||
@@ -16,6 +15,10 @@ struct Condition {
|
||||
Ref<Condition> cond2;
|
||||
};
|
||||
|
||||
struct BooleanColumnOrValue {
|
||||
ColumnOrValue col_or_val;
|
||||
};
|
||||
|
||||
struct Equal {
|
||||
Operation op1;
|
||||
Operation op2;
|
||||
@@ -84,9 +87,9 @@ struct Condition {
|
||||
};
|
||||
|
||||
using ReflectionType =
|
||||
rfl::TaggedUnion<"what", And, Equal, GreaterEqual, GreaterThan, In,
|
||||
IsNull, IsNotNull, LesserEqual, LesserThan, Like, Not,
|
||||
NotEqual, NotIn, NotLike, Or>;
|
||||
rfl::TaggedUnion<"what", And, BooleanColumnOrValue, Equal, GreaterEqual,
|
||||
GreaterThan, In, IsNull, IsNotNull, LesserEqual,
|
||||
LesserThan, Like, Not, NotEqual, NotIn, NotLike, Or>;
|
||||
|
||||
const ReflectionType& reflection() const { return val; }
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ struct Duration {
|
||||
int64_t val;
|
||||
};
|
||||
|
||||
struct Boolean {
|
||||
bool val;
|
||||
};
|
||||
|
||||
struct Float {
|
||||
double val;
|
||||
};
|
||||
@@ -30,8 +34,8 @@ struct Timestamp {
|
||||
};
|
||||
|
||||
struct Value {
|
||||
using ReflectionType =
|
||||
rfl::TaggedUnion<"type", Duration, Float, Integer, String, Timestamp>;
|
||||
using ReflectionType = rfl::TaggedUnion<"type", Duration, Boolean, Float,
|
||||
Integer, String, Timestamp>;
|
||||
const auto& reflection() const { return val; }
|
||||
ReflectionType val;
|
||||
};
|
||||
|
||||
@@ -20,6 +20,9 @@ struct ToValue {
|
||||
if constexpr (std::is_floating_point_v<Type>) {
|
||||
return dynamic::Value{dynamic::Float{.val = static_cast<double>(_t)}};
|
||||
|
||||
} else if constexpr (std::is_same_v<Type, bool>) {
|
||||
return dynamic::Value{dynamic::Boolean{.val = _t}};
|
||||
|
||||
} else if constexpr (std::is_integral_v<Type>) {
|
||||
return dynamic::Value{dynamic::Integer{.val = static_cast<int64_t>(_t)}};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user