Neo4rs CircleCI

Neo4rs is a native rust driver implemented using bolt 4.1 specification

Getting Started

```rust
//Connect to server let uri = "127.0.0.1:7687".toowned(); let user = "neo4j"; let pass = "neo4j"; let graph = Graph::connect(uri, user, pass).await.unwrap(); assert!(graph.query("RETURN 1").run().await.isok());

//Concurrent queries
let uri = "127.0.0.1:7687";
let user = "neo4j";
let pass = "neo";
let graph = Arc::new(Graph::connect(uri, user, pass).await.unwrap());
for _ in 1..=10000 {
    let graph = graph.clone();
    tokio::spawn(async move {
        let mut result = graph.query("MATCH (p) RETURN p").execute().await.unwrap();
        while let Some(row) = result.next().await {
            //process row
        }
    });
}


//Create a node and process the response
let mut result = graph
    .query("CREATE (friend:Person {name: $name}) RETURN friend")
    .param("name", "Mark")
    .execute()
    .await
    .unwrap();
let row = result.next().await.unwrap();
let node: Node = row.get("friend").unwrap();
let id = node.id();
let labels = node.labels();
let name: String = node.get("name").unwrap();
assert_eq!(name, "Mark");
assert_eq!(labels, vec!["Person"]);


//Drain the response stream
let mut result = graph
    .query("MATCH (p:Person {name: 'Mark'}) RETURN p")
    .execute()
    .await
    .unwrap();

while let Some(row) = result.next().await {
    let node: Node = row.get("friend").unwrap();
    let name: String = node.get("name").unwrap();
//process name & node
}


//Create and parse relationship
let mut result = graph
    .query("CREATE (p:Person { name: 'Mark' })-[r:WORKS_AT {as: 'Engineer'}]->(neo) RETURN r")
    .execute()
    .await
    .unwrap();

let row = result.next().await.unwrap();

let relation: Relation = row.get("r").unwrap();
assert!(relation.id() > 0);
assert!(relation.start_node_id() > 0);
assert!(relation.end_node_id() > 0);
assert_eq!(relation.typ(), "WORKS_AT");
assert_eq!(relation.get::<String>("as").unwrap(), "Engineer");

```

Installation

neo4rs is available on crates.io and can be included in your Cargo enabled project like this:

toml [dependencies] neo4rs = "0.1.1"


Roadmap