Rust API¶
CongraphDB is written in Rust, and you can use it directly in Rust projects.
Documentation¶
The full Rust API documentation is published on docs.rs.
Cargo.toml¶
Add to your Cargo.toml:
Basic Usage¶
use congraphdb::{Database, Connection};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Open a database
let db = Database::new("my-graph.cgraph")?;
db.init()?;
// Create a connection
let conn = db.create_connection()?;
// Execute a query
let result = conn.query(
"CREATE (u:User {name: 'Alice', age: 30})"
)?;
// Query data
let result = conn.query(
"MATCH (u:User) RETURN u.name, u.age"
)?;
for row in result {
println!("{:?}", row);
}
Ok(())
}
API Reference¶
For the complete API reference, see:
- docs.rs/congraphdb — Official documentation
- GitHub Repository — Source code
Internal Modules¶
storage— Storage engine and data structuresquery— Cypher query parser and executorindex— Index implementations (HNSW, hash)table— Table and schema management
Contributing¶
If you're interested in contributing to CongraphDB core development, see: