rust_queries_builder/lib.rs
1//! # Rust Query Builder
2//!
3//! A powerful, type-safe query builder library for Rust that leverages key-paths
4//! for SQL-like operations on in-memory collections.
5//!
6//! ## Features
7//!
8//! - **Type-safe queries**: Compile-time type checking using key-paths
9//! - **SQL-like operations**: WHERE, SELECT, ORDER BY, GROUP BY, JOIN
10//! - **Aggregations**: COUNT, SUM, AVG, MIN, MAX
11//! - **Pagination**: LIMIT and SKIP operations
12//! - **Join operations**: INNER JOIN, LEFT JOIN with custom predicates
13//! - **Zero-cost abstractions**: Leverages Rust's zero-cost abstractions
14//!
15//! ## Example
16//!
17//! ```rust
18//! use rust_queries_builder::{Query, QueryExt};
19//! use key_paths_derive::Keypath;
20//!
21//! #[derive(Clone, Keypath)]
22//! struct Product {
23//! id: u32,
24//! name: String,
25//! price: f64,
26//! category: String,
27//! }
28//!
29//! let products = vec![
30//! Product { id: 1, name: "Laptop".to_string(), price: 999.99, category: "Electronics".to_string() },
31//! Product { id: 2, name: "Mouse".to_string(), price: 29.99, category: "Electronics".to_string() },
32//! ];
33//!
34//! // Using extension trait - most ergonomic
35//! let query = products.query().where_(Product::category_r(), |cat| cat == "Electronics");
36//! let electronics = query.all();
37//!
38//! // Traditional approach
39//! let affordable = Query::new(&products)
40//! .where_(Product::price_r(), |&price| price < 100.0)
41//! .all();
42//!
43//! // Lazy evaluation for better performance
44//! let total = products.lazy_query().sum_by(Product::price_r());
45//! ```
46
47// Re-export everything from core
48pub use rust_queries_core::*;
49
50// Re-export derive macros
51pub use rust_queries_derive::{Queryable as QueryableDerive, QueryBuilder};
52
53// Re-export keypath derive macro for convenience
54pub use key_paths_derive::Keypath;