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
Code in examples are assumed to be wrapped in:
extern crate rusted_cypher;
use BTreeMap;
use GraphClient;
use Statement;
Performing Queries
let mut query = graph.cypher.query;
// Statement implements From<&str>
query.add_statement;
let statement = new
.with_param;
query.add_statement;
query.send.unwrap;
graph.cypher.exec
.unwrap;
let result = graph.cypher.exec
.unwrap;
assert_eq!;
for row in result.rows
graph.cypher.exec.unwrap;
With Transactions
let transaction = graph.cypher.transaction
.with_statement;
let = transaction.begin.unwrap;
// Use `exec` to execute a single statement
transaction.exec
.unwrap;
// use `add_statement` (or `with_statement`) and `send` to executes multiple statements
let stmt = new
.with_param;
transaction.add_statement;
let results = transaction.send.unwrap;
assert_eq!;
transaction.rollback;
Statements with Macro
There is a macro to help building statements
let statement = cypher_stmt!;
graph.cypher.exec.unwrap;
let statement = cypher_stmt!;
let results = graph.cypher.exec.unwrap;
assert_eq!;
let statement = cypher_stmt!;
graph.cypher.exec.unwrap;
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.