#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum SqlType {
NumericComparable(NumericComparableType),
StringComparableLoose(StringComparableLoseType),
BinaryComparable,
BooleanComparable,
TimestampComparable,
DurationComparable,
}
impl SqlType {
pub fn small_int() -> SqlType {
SqlType::NumericComparable(NumericComparableType::I64Loose(I64LooseType::SmallInt))
}
pub fn integer() -> SqlType {
SqlType::NumericComparable(NumericComparableType::I64Loose(I64LooseType::Integer))
}
pub fn big_int() -> SqlType {
SqlType::NumericComparable(NumericComparableType::I64Loose(I64LooseType::BigInt))
}
pub fn unsigned_integer() -> SqlType {
SqlType::NumericComparable(NumericComparableType::U64Loose(
U64LooseType::UnsignedInteger,
))
}
pub fn unsigned_big_int() -> SqlType {
SqlType::NumericComparable(NumericComparableType::U64Loose(
U64LooseType::UnsignedBigInt,
))
}
pub fn float() -> SqlType {
SqlType::NumericComparable(NumericComparableType::F32Loose(F32LooseType::Float))
}
pub fn text() -> SqlType {
SqlType::StringComparableLoose(StringComparableLoseType::Text)
}
pub fn blob() -> SqlType {
SqlType::BinaryComparable
}
pub fn boolean() -> SqlType {
SqlType::BooleanComparable
}
pub fn timestamp() -> SqlType {
SqlType::TimestampComparable
}
pub fn duration() -> SqlType {
SqlType::DurationComparable
}
}
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum NumericComparableType {
I64Loose(I64LooseType),
U64Loose(U64LooseType),
F32Loose(F32LooseType),
}
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum I64LooseType {
SmallInt,
Integer,
BigInt,
}
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum U64LooseType {
UnsignedInteger,
UnsignedBigInt,
}
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum F32LooseType {
Float,
}
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum StringComparableLoseType {
Text,
}