rust_queries_core/
lib.rs

1//! # Rust Query Builder Core
2//!
3//! Core functionality for rust-queries-builder - a powerful, type-safe query builder 
4//! library for Rust that leverages key-paths for SQL-like operations on in-memory collections.
5//!
6//! This crate contains the core query building logic, without proc-macros or derive functionality.
7//!
8//! ## Features
9//!
10//! - Type-safe queries with compile-time checking
11//! - SQL-like operations: WHERE, SELECT, ORDER BY, GROUP BY, JOIN
12//! - Rich aggregations: COUNT, SUM, AVG, MIN, MAX
13//! - Pagination: LIMIT and SKIP
14//! - Join operations: INNER, LEFT, RIGHT, CROSS
15//! - Zero-cost abstractions
16//! - Clone-free operations
17//! - Lazy evaluation with early termination
18//! - Extension traits for ergonomic API
19//! - Helper macros to reduce boilerplate
20//!
21//! ## Example
22//!
23//! ```rust
24//! use rust_queries_core::{Query, QueryExt};
25//! use key_paths_derive::Keypath;
26//!
27//! #[derive(Keypath)]
28//! struct Product {
29//!     id: u32,
30//!     name: String,
31//!     price: f64,
32//! }
33//!
34//! let products = vec![
35//!     Product { id: 1, name: "Laptop".to_string(), price: 999.99 },
36//!     Product { id: 2, name: "Mouse".to_string(), price: 29.99 },
37//! ];
38//!
39//! // Using extension trait
40//! let query = products.query().where_(Product::price(), |&p| p > 100.0);
41//! let expensive = query.all();
42//! ```
43
44pub mod query;
45pub mod join;
46pub mod lazy;
47pub mod lazy_join;
48pub mod lazy_parallel;
49pub mod queryable;
50pub mod ext;
51pub mod datetime;
52pub mod locks;
53pub mod lock_query;
54pub mod lock_lazy;
55pub mod lock_join;
56pub mod lock_view;
57pub mod lock_ext;
58
59#[macro_use]
60pub mod macros;
61
62pub use query::{Query, QueryWithSkip};
63pub use join::JoinQuery;
64#[cfg(feature = "parallel")]
65pub use join::ParallelJoinExt;
66pub use lazy::LazyQuery;
67pub use lazy_join::LazyJoinQuery;
68#[cfg(feature = "parallel")]
69pub use lazy_parallel::{LazyParallelQuery, LazyParallelQueryExt};
70pub use queryable::Queryable;
71pub use ext::{QueryExt, QueryableExt};
72pub use locks::{LockValue, LockQueryExt, LockIterExt, LockedValueRef};
73pub use lock_query::{LockQuery, LockQueryable, LockLazyQueryable};
74pub use lock_lazy::LockLazyQuery;
75pub use lock_join::{LockJoinQuery, LockJoinable, LockJoinableCollection};
76pub use lock_view::{LockView, MaterializedLockView};
77
78// Re-export lock extensions for parking_lot and tokio
79#[cfg(feature = "parking_lot")]
80pub use lock_ext::{
81    ParkingLotRwLockWrapper, ParkingLotMutexWrapper,
82    ParkingLotQueryExt, ParkingLotMutexQueryExt,
83    ParkingLotJoinExt, ParkingLotMutexJoinExt,
84};
85
86#[cfg(feature = "tokio")]
87pub use lock_ext::{
88    TokioRwLockWrapper, TokioMutexWrapper,
89    TokioLockQueryExt, TokioMutexQueryExt,
90    TokioLockJoinExt, TokioMutexJoinExt,
91};
92
93// Re-export key-paths for convenience
94pub use key_paths_core::KeyPaths;
95