geode_client/lib.rs
1#![forbid(unsafe_code)]
2//! Geode Rust Client Library
3//!
4//! A high-performance async Rust client for Geode graph database with full GQL support.
5//! Supports both QUIC and gRPC transports using protobuf wire protocol.
6//!
7//! # Features
8//!
9//! - 🚀 Fully async using tokio with type safety
10//! - 🔒 QUIC + TLS 1.3 or gRPC for flexible networking
11//! - 📝 Full GQL (ISO/IEC 39075:2024) support
12//! - 🏗️ Query builders for programmatic query construction
13//! - 🔐 Authentication & RBAC with RLS policies
14//! - 🏊 Connection pooling for concurrent workloads
15//! - 📊 Rich type system with Decimal, temporal types
16//!
17//! # Transport Options
18//!
19//! ## QUIC Transport (default)
20//!
21//! ```no_run
22//! use geode_client::{Client, Result};
23//!
24//! #[tokio::main]
25//! async fn main() -> Result<()> {
26//! // Connect via QUIC using DSN
27//! let client = Client::from_dsn("quic://127.0.0.1:3141?insecure=true")?;
28//! let mut conn = client.connect().await?;
29//! let (page, _) = conn.query("RETURN 1 AS x").await?;
30//! conn.close()?;
31//! Ok(())
32//! }
33//! ```
34//!
35//! ## gRPC Transport
36//!
37//! ```no_run
38//! use geode_client::{Client, Result};
39//!
40//! #[tokio::main]
41//! async fn main() -> Result<()> {
42//! // Connect via gRPC using DSN
43//! let client = Client::from_dsn("grpc://127.0.0.1:50051")?;
44//! let mut conn = client.connect().await?;
45//! let (page, _) = conn.query("RETURN 1 AS x").await?;
46//! conn.close()?;
47//! Ok(())
48//! }
49//! ```
50//!
51//! # DSN Formats
52//!
53//! - `quic://host:port?options` - QUIC transport (default port: 3141)
54//! - `grpc://host:port?options` - gRPC transport
55//! - `host:port?options` - Legacy format, defaults to QUIC
56
57pub mod auth;
58pub mod batch;
59pub mod client;
60mod convert;
61pub mod crypto;
62pub mod dsn;
63pub mod error;
64pub mod pool;
65pub mod proto;
66pub mod query_builder;
67pub mod quote;
68pub mod retry;
69pub mod schema;
70pub mod types;
71pub mod validate;
72
73// gRPC transport module
74#[cfg(feature = "grpc")]
75pub mod grpc;
76
77// Re-export main types
78pub use auth::{AuthClient, Permission, RLSPolicy, Role, SessionInfo, User};
79pub use batch::{DEFAULT_CHUNK_SIZE, DEFAULT_MAX_WORKERS};
80pub use client::{
81 Client, Column, Connection, Page, PlanOperation, PreparedStatement, QueryPlan, QueryProfile,
82 Savepoint,
83};
84pub use crypto::Cipher;
85pub use dsn::{DEFAULT_PORT, Dsn, Transport};
86pub use error::{Error, Result};
87pub use pool::ConnectionPool;
88pub use query_builder::{EdgeDirection, PatternBuilder, PredicateBuilder, QueryBuilder};
89pub use quote::{quote_ident, quote_string, sanitize_graph_name};
90pub use retry::{RetryPolicy, retry};
91pub use schema::{Statement, parse_schema_fs};
92pub use types::{Edge, Node, Path, Range, Value, ValueKind};
93
94/// Library version
95pub const VERSION: &str = env!("CARGO_PKG_VERSION");