mod tensor;
mod spatial;
mod text;
mod timestamp;
mod table;
pub use tensor::Tensor;
pub use spatial::{Geometry, Point, BoundingBox};
pub use text::{Text, TextDoc};
pub use timestamp::Timestamp;
pub use table::{TableSchema, ColumnDef, ColumnType, IndexDef, IndexType, Column};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum Value {
Integer(i64),
Float(f64),
Bool(bool),
Text(String),
Vector(Vec<f32>),
Tensor(Tensor),
Spatial(Geometry),
TextDoc(Text),
Timestamp(Timestamp),
Null,
}
impl PartialOrd for Value {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
match (self, other) {
(Value::Integer(a), Value::Integer(b)) => a.partial_cmp(b),
(Value::Float(a), Value::Float(b)) => a.partial_cmp(b),
(Value::Text(a), Value::Text(b)) => a.partial_cmp(b),
(Value::Bool(a), Value::Bool(b)) => a.partial_cmp(b),
(Value::Timestamp(a), Value::Timestamp(b)) => a.partial_cmp(b),
(Value::Integer(a), Value::Float(b)) => (*a as f64).partial_cmp(b),
(Value::Float(a), Value::Integer(b)) => a.partial_cmp(&(*b as f64)),
_ => None,
}
}
}
pub type Row = Vec<Value>;
pub type SqlRow = std::collections::HashMap<String, Value>;
pub type RowId = u64;
pub type PartitionId = u8;