fraiseql_core/lib.rs
1//! # FraiseQL Core
2//!
3//! Core execution engine for FraiseQL v2 - A compiled GraphQL execution engine.
4//!
5//! ## Architecture
6//!
7//! FraiseQL v2 compiles GraphQL schemas into optimized SQL execution plans at build time,
8//! eliminating runtime overhead and enabling deterministic, high-performance query execution.
9//!
10//! ### Key Components
11//!
12//! - **Schema**: Compiled schema representation (reused from v1)
13//! - **Compiler**: GraphQL schema → SQL template compiler (new for v2)
14//! - **Runtime**: Compiled query executor (new for v2)
15//! - **Database**: Connection pooling and transaction management (from v1)
16//! - **Cache**: Query result caching with coherency (from v1)
17//! - **Security**: Authentication, authorization, and audit (from v1)
18//! - **APQ**: Automatic Persisted Queries (from v1)
19//!
20//! ## Compilation Flow
21//!
22//! ```text
23//! Python/TypeScript Decorators
24//! ↓
25//! JSON Schema
26//! ↓
27//! Compiler
28//! ↙ ↓ ↘
29//! Parse Validate Codegen
30//! ↓
31//! CompiledSchema.json
32//! ↓
33//! Runtime
34//! ↙ ↓ ↘
35//! Match Execute Project
36//! ↓
37//! GraphQL Response
38//! ```
39//!
40//! ## Example
41//!
42//! ```ignore
43//! use fraiseql_core::schema::CompiledSchema;
44//! use fraiseql_core::runtime::Executor;
45//!
46//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
47//! // Load compiled schema
48//! let schema = CompiledSchema::from_file("schema.compiled.json")?;
49//!
50//! // Create executor
51//! let executor = Executor::new(schema, db_pool).await?;
52//!
53//! // Execute query
54//! let query = r#"query { users { id name } }"#;
55//! let result = executor.execute(query, None).await?;
56//!
57//! println!("{}", result);
58//! # Ok(())
59//! # }
60//! ```
61
62#![forbid(unsafe_code)]
63// Missing docs allowed for internal items - public API is fully documented
64#![allow(missing_docs)]
65#![warn(clippy::all)]
66#![warn(clippy::pedantic)]
67// Allow common pedantic lints that are too noisy for this codebase
68#![allow(clippy::doc_markdown)] // Would require 150+ doc changes for backticks
69#![allow(clippy::return_self_not_must_use)] // Builder pattern doesn't always need #[must_use]
70#![allow(clippy::uninlined_format_args)] // Style preference, not a bug
71#![allow(clippy::unused_self)] // Often needed for trait consistency
72#![allow(clippy::unnecessary_wraps)] // Sometimes needed for API consistency
73#![allow(clippy::must_use_candidate)] // Too noisy for builder methods
74#![allow(clippy::missing_errors_doc)] // Would require extensive doc additions
75#![allow(clippy::module_name_repetitions)] // Common in Rust APIs
76#![allow(clippy::match_same_arms)] // Sometimes clearer to be explicit
77#![allow(clippy::cast_possible_truncation)] // Many intentional u64->u32 casts
78#![allow(clippy::cast_precision_loss)] // Intentional f64 conversions
79#![allow(clippy::cast_sign_loss)] // Intentional signed->unsigned conversions
80#![allow(clippy::too_many_arguments)] // Some complex functions need many args
81#![allow(clippy::format_push_string)] // Sometimes clearer than write!
82#![allow(clippy::redundant_closure_for_method_calls)] // Sometimes clearer
83#![allow(clippy::explicit_iter_loop)] // Explicit .iter() can be clearer
84#![allow(clippy::bool_to_int_with_if)] // Sometimes clearer than conversion
85#![allow(clippy::single_match_else)] // Sometimes clearer than if-else
86#![allow(clippy::wildcard_imports)] // Used intentionally for enum variants
87#![allow(clippy::struct_excessive_bools)] // AutoParams struct uses bools for flags
88#![allow(clippy::missing_panics_doc)] // Would require extensive doc additions
89#![allow(clippy::similar_names)] // Variable naming style
90#![allow(clippy::option_if_let_else)] // Sometimes clearer
91#![allow(clippy::if_not_else)] // Sometimes clearer
92#![allow(clippy::useless_format)] // Sometimes needed for consistency
93#![allow(clippy::or_fun_call)] // Sometimes clearer with function call
94#![allow(clippy::unused_async)] // Placeholder for future async work
95#![allow(clippy::should_implement_trait)] // from_str intentionally different
96#![allow(clippy::needless_pass_by_value)] // Sometimes clearer API
97#![allow(clippy::manual_saturating_arithmetic)] // Explicit can be clearer
98#![allow(clippy::match_wildcard_for_single_variants)] // Sometimes clearer
99#![allow(clippy::single_char_pattern)] // Very minor optimization
100#![allow(clippy::doc_link_with_quotes)] // Documentation style choice
101#![allow(clippy::collapsible_if)] // Sometimes clearer when separate
102#![allow(clippy::map_unwrap_or)] // Sometimes clearer
103#![allow(clippy::manual_map)] // Sometimes clearer
104#![allow(clippy::default_trait_access)] // Map::default() vs Default::default()
105#![allow(clippy::implicit_saturating_sub)] // Explicit subtraction can be clearer
106#![allow(clippy::ptr_arg)] // Sometimes &Vec is clearer than &[T]
107#![allow(clippy::enum_glob_use)] // Wildcard enum imports for readability
108#![allow(clippy::unwrap_or_default)] // or_insert_with(Vec::new) style preference
109#![allow(clippy::redundant_closure)] // Sometimes clearer
110#![allow(clippy::suspicious_doc_comments)] // /// vs //! style is intentional
111#![allow(clippy::float_cmp)] // Test assertions with exact float comparison are intentional
112
113// Core modules
114pub mod config;
115pub mod error;
116pub mod schema;
117
118// Compilation layer
119pub mod compiler;
120
121// Execution layer
122pub mod runtime;
123
124// GraphQL parsing and query processing
125pub mod graphql;
126
127// Infrastructure
128pub mod apq;
129pub mod audit;
130pub mod cache;
131pub mod db;
132pub mod design;
133pub mod federation;
134pub mod filters;
135pub mod observability;
136pub mod security;
137pub mod tenancy;
138pub mod utils;
139pub mod validation;
140
141// Arrow Flight integration (optional)
142#[cfg(feature = "arrow")]
143pub mod arrow_executor;
144
145// Re-exports for convenience
146pub use config::FraiseQLConfig;
147pub use error::{FraiseQLError, Result};
148pub use schema::CompiledSchema;
149pub use tenancy::TenantContext;
150
151/// Version of the FraiseQL core library
152pub const VERSION: &str = env!("CARGO_PKG_VERSION");
153
154/// Minimum supported Rust version
155pub const MSRV: &str = "1.75";