chore: box structs into modules (catalog, eav, filter)

This commit is contained in:
2025-11-14 19:30:16 +01:00
parent 4010149ea6
commit 7847394d13
4 changed files with 38 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
use heave::*; use heave::catalog::*;
use heave::eav::*;
// Define a struct named `Product` to represent a product. // Define a struct named `Product` to represent a product.
#[derive(PartialEq, Clone)] #[derive(PartialEq, Clone)]

View File

@@ -1,4 +1,6 @@
use heave::*; use heave::catalog::*;
use heave::eav::*;
use heave::filter::*;
// Define a struct named `Component` to represent an electronic component. // Define a struct named `Component` to represent an electronic component.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]

View File

@@ -1,3 +1,6 @@
use heave::catalog::*;
use heave::eav::*;
use heave::filter::*;
use heave::*; use heave::*;
use std::path::Path; use std::path::Path;

View File

@@ -187,22 +187,42 @@ mod tst;
pub use crate::str::failed_to::FailedTo; pub use crate::str::failed_to::FailedTo;
pub(crate) use crate::str::attribute::O as Attribute; /// The `catalog` module provides the `Catalog` struct, which serves as the main entry point
pub(crate) use crate::str::value::Value; /// for interacting with the EAV database. It manages the connection to the SQLite file
/// and maintains an in-memory cache of entities.
pub mod catalog {
pub use crate::str::catalog::O as Catalog;
}
pub use crate::str::entity::O as Entity; /// The `eav` module defines the core components of the Entity-Attribute-Value (EAV) model.
pub use crate::str::entity_state::EntityState; /// It includes the `EAV` trait, which custom structs must implement to be stored as entities,
pub use crate::trt::eav::T as EAV; /// as well as the `Entity` struct for generic entity representation, `Attribute` for entity properties,
/// `Value` for attribute values, and `EntityState` for tracking entity changes.
pub mod eav {
pub(crate) use crate::str::attribute::O as Attribute;
pub use crate::str::entity::O as Entity;
pub use crate::str::entity_state::EntityState;
pub(crate) use crate::str::value::Value;
pub use crate::trt::eav::T as EAV;
}
pub use crate::str::comparison::E as Comparison; /// The `filter` module provides tools for constructing complex queries to retrieve entities
pub use crate::str::condition::E as Condition; /// from the database. It includes the `Filter` struct for building query conditions,
pub use crate::str::filter::O as Filter; /// `Condition` for defining individual filtering criteria, and `Comparison` for specifying
/// how values should be compared.
pub use crate::str::catalog::O as Catalog; pub mod filter {
pub use crate::str::comparison::E as Comparison;
pub use crate::str::condition::E as Condition;
pub use crate::str::filter::O as Filter;
}
#[cfg(test)] #[cfg(test)]
pub(crate) use crate::str::item::O as Item; pub(crate) use crate::str::item::O as Item;
use catalog::*;
use eav::*;
use filter::*;
mod sqlite { mod sqlite {
pub use crate::str::sqlite_failed_to::FailedTo; pub use crate::str::sqlite_failed_to::FailedTo;
pub mod build { pub mod build {