rusted_cypher
Rust crate for accessing the cypher endpoint of a neo4j server
This crate allows you to send cypher queries to the REST endpoint of a neo4j database. You can execute queries inside a transaction or simply send queries that commit immediately.
Examples
Connecting to a Neo4j database
use GraphClient;
let graph = connect;
Performing Queries
let mut query = graph.query;
// Statement implements From<&str>
query.add_statement;
let statement = new
.with_param?;
query.add_statement;
query.send?;
graph.exec?;
let result = graph.exec?;
assert_eq!;
for row in result.rows
graph.exec?;
With Transactions
let transaction = graph
.transaction
.with_statement;
let = transaction.begin.unwrap;
// Use `exec` to execute a single statement
transaction.exec?;
// use `add_statement` (or `with_statement`) and `send` to executes multiple statements
let stmt = new
.with_param?;
transaction.add_statement;
let results = transaction.send?;
assert_eq!;
transaction.rollback?;
}
Statements with Macro
There is a macro to help building statements
let statement = cypher_stmt!?;
graph.exec?;
let statement = cypher_stmt!?;
let results = graph.exec?;
assert_eq!;
let statement = cypher_stmt!?;
graph.exec?;
License
Licensed under either of
- 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)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.