Neo4rs is a Neo4j rust driver implemented using bolt specification
This driver is compatible with neo4j 4.x versions
// concurrent queries
let uri = "127.0.0.1:7687";
let user = "neo4j";
let pass = "neo";
let graph = Arc::new(Graph::new(&uri, user, pass).await.unwrap());
for _ in 1..=42 {
let graph = graph.clone();
tokio::spawn(async move {
let mut result = graph.execute(
query("MATCH (p:Person {name: $name}) RETURN p").param("name", "Mark")
).await.unwrap();
while let Ok(Some(row)) = result.next().await {
let node: Node = row.get("p").unwrap();
let name: String = node.get("name").unwrap();
println!("{}", name);
}
});
}
//Transactions
let mut txn = graph.start_txn().await.unwrap();
txn.run_queries(vec![
query("CREATE (p:Person {name: 'mark'})"),
query("CREATE (p:Person {name: 'jake'})"),
query("CREATE (p:Person {name: 'luke'})"),
])
.await
.unwrap();
txn.commit().await.unwrap(); //or txn.rollback().await.unwrap();
Neo4rs is licensed under either of the following, at your option:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)