Skip to main content

geode_client/
lib.rs

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