fraiseql_wire/operators/mod.rs
1//! Operator-based SQL generation system
2//!
3//! This module provides type-safe operator abstractions for building WHERE clauses,
4//! ORDER BY clauses, and query modifiers (LIMIT/OFFSET) without raw SQL strings.
5//!
6//! # Design Philosophy
7//!
8//! fraiseql-wire maintains backward compatibility with the existing string-based API
9//! while offering operator abstractions for type safety and auditability:
10//!
11//! ```ignore
12//! // Old style (still works)
13//! client.query("users")
14//! .where_sql("data->>'name' = 'John'")
15//! .execute()
16//! .await?;
17//!
18//! // New style (type-safe)
19//! client.query("users")
20//! .where_operator(WhereOperator::Eq(
21//! Field::JsonbField("name".to_string()),
22//! Value::String("John".to_string()),
23//! ))
24//! .execute()
25//! .await?;
26//! ```
27//!
28//! # Operator Coverage
29//!
30//! - **Comparison**: Eq, Neq, Gt, Gte, Lt, Lte
31//! - **Array**: In, Nin, Contains, ArrayContains, ArrayContainedBy, ArrayOverlaps
32//! - **Array Length**: LenEq, LenGt, LenGte, LenLt, LenLte
33//! - **String**: Contains, Icontains, Startswith, Endswith, Like, Ilike
34//! - **Null**: IsNull
35//! - **Vector Distance**: L2Distance, CosineDistance, InnerProduct, JaccardDistance
36//! - **Full-Text Search**: Matches, PlainQuery, PhraseQuery, WebsearchQuery
37//! - **Network**: IsIPv4, IsIPv6, IsPrivate, IsLoopback, InSubnet, ContainsSubnet, ContainsIP, IPRangeOverlap
38
39pub mod field;
40pub mod order_by;
41pub mod sql_gen;
42pub mod where_operator;
43
44pub use field::{Field, Value};
45pub use order_by::{Collation, FieldSource, NullsHandling, OrderByClause, SortOrder};
46pub use sql_gen::generate_where_operator_sql;
47pub use where_operator::WhereOperator;