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 client;
60mod convert;
61pub mod dsn;
62pub mod error;
63pub mod graph;
64pub mod pool;
65pub mod proto;
66pub mod query_builder;
67pub mod quote;
68pub mod retry;
69pub mod types;
70pub mod validate;
71
72// gRPC transport module
73#[cfg(feature = "grpc")]
74pub mod grpc;
75
76// Re-export main types
77pub use auth::{AuthClient, Permission, RLSPolicy, Role, SessionInfo, User};
78pub use client::{
79    Client, Column, Connection, Page, PlanOperation, PreparedStatement, QueryPlan, QueryProfile,
80    Savepoint, redact_dsn,
81};
82pub use dsn::{DEFAULT_PORT, Dsn, Transport};
83pub use error::{Error, Result};
84pub use graph::{Edge, Node, Path, as_edge, as_node, as_path};
85pub use pool::ConnectionPool;
86pub use query_builder::{EdgeDirection, PatternBuilder, PredicateBuilder, QueryBuilder};
87pub use quote::{quote_ident, quote_string, sanitize_graph_name};
88pub use retry::{RetryPolicy, retry};
89pub use types::{Range, Value, ValueKind};
90
91/// Library version
92pub const VERSION: &str = env!("CARGO_PKG_VERSION");