From 58641d71979171963ab351c8eb045e3714b4bd6c Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Sat, 27 Sep 2025 07:26:41 +0200 Subject: [PATCH] feat: add basic structures for EAV modeling (entity, attribute, value) --- 01.workspace/heave/src/fun/mod.rs | 1 + 01.workspace/heave/src/imp/mod.rs | 1 + 01.workspace/heave/src/lib.rs | 4 ++++ 01.workspace/heave/src/mcr/mod.rs | 1 + 01.workspace/heave/src/str/attribute.rs | 7 +++++++ 01.workspace/heave/src/str/entity.rs | 7 +++++++ 01.workspace/heave/src/str/mod.rs | 3 +++ 01.workspace/heave/src/str/value.rs | 10 ++++++++++ 01.workspace/heave/src/trt/mod.rs | 1 + 01.workspace/heave/src/tst/mod.rs | 1 + 10 files changed, 36 insertions(+) create mode 100644 01.workspace/heave/src/str/attribute.rs create mode 100644 01.workspace/heave/src/str/entity.rs create mode 100644 01.workspace/heave/src/str/value.rs diff --git a/01.workspace/heave/src/fun/mod.rs b/01.workspace/heave/src/fun/mod.rs index e69de29..8b13789 100644 --- a/01.workspace/heave/src/fun/mod.rs +++ b/01.workspace/heave/src/fun/mod.rs @@ -0,0 +1 @@ + diff --git a/01.workspace/heave/src/imp/mod.rs b/01.workspace/heave/src/imp/mod.rs index e69de29..8b13789 100644 --- a/01.workspace/heave/src/imp/mod.rs +++ b/01.workspace/heave/src/imp/mod.rs @@ -0,0 +1 @@ + diff --git a/01.workspace/heave/src/lib.rs b/01.workspace/heave/src/lib.rs index 8784c5e..7e685c6 100644 --- a/01.workspace/heave/src/lib.rs +++ b/01.workspace/heave/src/lib.rs @@ -6,3 +6,7 @@ mod mcr; mod str; mod trt; mod tst; + +pub use crate::str::attribute::O as Attribute; +pub use crate::str::entity::O as Entity; +pub use crate::str::value::E as Value; diff --git a/01.workspace/heave/src/mcr/mod.rs b/01.workspace/heave/src/mcr/mod.rs index e69de29..8b13789 100644 --- a/01.workspace/heave/src/mcr/mod.rs +++ b/01.workspace/heave/src/mcr/mod.rs @@ -0,0 +1 @@ + diff --git a/01.workspace/heave/src/str/attribute.rs b/01.workspace/heave/src/str/attribute.rs new file mode 100644 index 0000000..7754589 --- /dev/null +++ b/01.workspace/heave/src/str/attribute.rs @@ -0,0 +1,7 @@ +use crate::*; + +#[derive(Debug, PartialEq, Clone)] +pub struct O { + pub id: String, + pub value: Value, +} diff --git a/01.workspace/heave/src/str/entity.rs b/01.workspace/heave/src/str/entity.rs new file mode 100644 index 0000000..aac1e73 --- /dev/null +++ b/01.workspace/heave/src/str/entity.rs @@ -0,0 +1,7 @@ +use crate::*; + +#[derive(Debug, Default, PartialEq, Clone)] +pub struct O { + pub class: String, + pub attributes: std::collections::HashMap, +} diff --git a/01.workspace/heave/src/str/mod.rs b/01.workspace/heave/src/str/mod.rs index e69de29..dd1e5a1 100644 --- a/01.workspace/heave/src/str/mod.rs +++ b/01.workspace/heave/src/str/mod.rs @@ -0,0 +1,3 @@ +pub mod attribute; +pub mod entity; +pub mod value; diff --git a/01.workspace/heave/src/str/value.rs b/01.workspace/heave/src/str/value.rs new file mode 100644 index 0000000..484bea7 --- /dev/null +++ b/01.workspace/heave/src/str/value.rs @@ -0,0 +1,10 @@ +use crate::*; + +#[derive(Debug, PartialEq, PartialOrd, Clone)] +pub enum E { + Bool(bool), + Real(f64), + SignedInt(i64), + Text(String), + UnsignedInt(u64), +} diff --git a/01.workspace/heave/src/trt/mod.rs b/01.workspace/heave/src/trt/mod.rs index e69de29..8b13789 100644 --- a/01.workspace/heave/src/trt/mod.rs +++ b/01.workspace/heave/src/trt/mod.rs @@ -0,0 +1 @@ + diff --git a/01.workspace/heave/src/tst/mod.rs b/01.workspace/heave/src/tst/mod.rs index e69de29..8b13789 100644 --- a/01.workspace/heave/src/tst/mod.rs +++ b/01.workspace/heave/src/tst/mod.rs @@ -0,0 +1 @@ +