1pub mod builder;
40pub mod collection;
41pub mod joins;
42pub mod lazy_url;
43pub mod loading;
44pub mod orm_integration;
45#[allow(clippy::module_inception)]
48pub mod proxy;
49pub mod query;
50pub mod reflection;
51pub mod scalar;
52pub mod url_namespace;
53pub mod url_pattern;
54pub mod url_resolver;
55
56pub use builder::{ProxyBuilder, association_proxy};
57pub use collection::{CollectionAggregations, CollectionOperations, CollectionProxy};
58pub use joins::{
59 CircularReferenceError, JoinConfig, NestedProxy, RelationshipPath, extract_through_path,
60 filter_through_path, traverse_and_extract, traverse_relationships,
61};
62pub use lazy_url::LazyUrl;
64pub use loading::{
65 EagerLoadConfig, EagerLoadable, LazyLoadable, LazyLoaded, LoadStrategy, RelationshipCache,
66};
67pub use orm_integration::OrmReflectable;
68pub use reinhardt_db::orm::LoadingStrategy;
69
70pub use proxy::{AssociationProxy, ProxyAccessor, ProxyTarget, ScalarValue};
73pub use query::{FilterCondition, FilterOp, QueryFilter};
74pub use reflection::{
75 AttributeExtractor, ProxyCollection, Reflectable, ReflectableFactory, downcast_relationship,
76 extract_collection_values,
77};
78pub use scalar::{ScalarComparison, ScalarProxy};
79pub use url_namespace::UrlNamespace;
80pub use url_pattern::UrlPattern;
81pub use url_resolver::UrlResolver;
82
83use thiserror::Error;
84
85pub type ProxyResult<T> = Result<T, ProxyError>;
87
88#[derive(Debug, Error)]
90pub enum ProxyError {
91 #[error("Target relationship '{0}' not found")]
93 RelationshipNotFound(String),
94
95 #[error("Attribute '{0}' not found on target")]
97 AttributeNotFound(String),
98
99 #[error("Type mismatch: expected {expected}, got {actual}")]
101 TypeMismatch {
102 expected: String,
104 actual: String,
106 },
107
108 #[error("Invalid proxy configuration: {0}")]
110 InvalidConfiguration(String),
111
112 #[error("Database error: {0}")]
114 DatabaseError(String),
115
116 #[error("Serialization error: {0}")]
118 SerializationError(String),
119
120 #[error(
122 "Factory not configured for collection proxy - required for creating objects from scalar values"
123 )]
124 FactoryNotConfigured,
125
126 #[error("Version tracking is not enabled for this proxy")]
128 VersionTrackingNotEnabled,
129
130 #[error("Version mismatch: expected {expected}, got {actual}")]
132 VersionMismatch {
133 expected: i64,
135 actual: i64,
137 },
138}