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.
#[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.
#[derive(Debug, Clone, PartialEq)]

View File

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

View File

@@ -187,22 +187,42 @@ mod tst;
pub use crate::str::failed_to::FailedTo;
pub(crate) use crate::str::attribute::O as Attribute;
pub(crate) use crate::str::value::Value;
/// The `catalog` module provides the `Catalog` struct, which serves as the main entry point
/// 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;
pub use crate::str::entity_state::EntityState;
pub use crate::trt::eav::T as EAV;
/// The `eav` module defines the core components of the Entity-Attribute-Value (EAV) model.
/// It includes the `EAV` trait, which custom structs must implement to be stored as entities,
/// 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;
pub use crate::str::condition::E as Condition;
pub use crate::str::filter::O as Filter;
pub use crate::str::catalog::O as Catalog;
/// The `filter` module provides tools for constructing complex queries to retrieve entities
/// from the database. It includes the `Filter` struct for building query conditions,
/// `Condition` for defining individual filtering criteria, and `Comparison` for specifying
/// how values should be compared.
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)]
pub(crate) use crate::str::item::O as Item;
use catalog::*;
use eav::*;
use filter::*;
mod sqlite {
pub use crate::str::sqlite_failed_to::FailedTo;
pub mod build {