diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-02-10 18:17:40 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-02-10 18:17:40 +0200 |
| commit | 591053c55753e00341bd739c00f9ff09ae6e8141 (patch) | |
| tree | debb9a661def6a9e93ad595a8bd44bfdcc2fefb9 /log_db/src/common.rs | |
| parent | eaa04ae170e57b1688bd10936a19fcb91f3409e0 (diff) | |
Remove typechecking
Diffstat (limited to 'log_db/src/common.rs')
| -rw-r--r-- | log_db/src/common.rs | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs index a450c28..2b40f52 100644 --- a/log_db/src/common.rs +++ b/log_db/src/common.rs @@ -183,58 +183,6 @@ pub enum IndexableValue { String(String), } -/// A primitive type -#[derive(Debug, Clone)] -pub enum PrimitiveType { - Int, - Decimal, - String, - Bytes, -} - -/// A primitive type + a nullability bit -#[derive(Debug, Clone)] -pub struct Type { - pub primitive: PrimitiveType, - pub nullable: bool, -} - -impl Type { - pub fn int() -> Self { - Type { - primitive: PrimitiveType::Int, - nullable: false, - } - } - - pub fn decimal() -> Self { - Type { - primitive: PrimitiveType::Decimal, - nullable: false, - } - } - - pub fn string() -> Self { - Type { - primitive: PrimitiveType::String, - nullable: false, - } - } - - pub fn bytes() -> Self { - Type { - primitive: PrimitiveType::Bytes, - nullable: false, - } - } - - pub fn nullable(&mut self) -> Self { - let mut new = self.clone(); - new.nullable = true; - new - } -} - #[derive(Debug, Clone)] pub enum Value { Null, @@ -341,41 +289,6 @@ impl Value { } } -pub fn type_check(value: &Value, value_type: &Type) -> bool { - match (value, value_type) { - ( - Value::Int(_), - Type { - primitive: PrimitiveType::Int, - .. - }, - ) => true, - ( - Value::Decimal(_), - Type { - primitive: PrimitiveType::Decimal, - .. - }, - ) => true, - ( - Value::Bytes(_), - Type { - primitive: PrimitiveType::Bytes, - .. - }, - ) => true, - ( - Value::String(_), - Type { - primitive: PrimitiveType::String, - .. - }, - ) => true, - (Value::Null, Type { nullable: true, .. }) => true, - _ => false, - } -} - pub fn get_secondary_memtable_index_by_field<Field: Eq>( sks: &Vec<Field>, field: &Field, |
