Module rusted_cypher::cypher
[−]
[src]
Provides structs used to interact with the cypher transaction endpoint
The types declared in this module, save for Statement
, don't need to be instantiated
directly, since they can be obtained from the GraphClient
.
Examples
Execute a single query
let graph = GraphClient::connect(URL).unwrap(); graph.cypher().exec("CREATE (n:CYPHER_QUERY {value: 1})").unwrap(); let result = graph.cypher().exec("MATCH (n:CYPHER_QUERY) RETURN n.value AS value").unwrap(); // Iterate over the results for row in result.rows() { let value = row.get::<i32>("value").unwrap(); // or: let value: i32 = row.get("value"); assert_eq!(value, 1); }
Execute multiple queries
let mut query = graph.cypher().query() .with_statement("MATCH (n:SOME_CYPHER_QUERY) RETURN n.value as value") .with_statement("MATCH (n:OTHER_CYPHER_QUERY) RETURN n"); let results = query.send().unwrap(); for row in results[0].rows() { let value: i32 = row.get("value").unwrap(); assert_eq!(value, 1); }
Start a transaction
let (transaction, results) = graph.cypher().transaction() .with_statement("MATCH (n:TRANSACTION_CYPHER_QUERY) RETURN n") .begin().unwrap();
Reexports
pub use self::transaction::Transaction; |
pub use self::result::CypherResult; |
Modules
result | |
statement | |
transaction |
Transaction management through neo4j's transaction endpoint |
Structs
Cypher |
Represents the cypher endpoint of a neo4j server |
CypherQuery |
Represents a cypher query |
Statement |
Represents a statement to be sent to the server |