Module rusted_cypher::cypher::transaction
[−]
[src]
Transaction management through neo4j's transaction endpoint
The recommended way to start a transaction is through the GraphClient
Examples
Starting a transaction
let mut transaction = graph.transaction(); transaction.add_statement("MATCH (n:TRANSACTION) RETURN n"); let (transaction, results) = transaction.begin()?;
Statement is optional when beggining a transaction
let (transaction, _) = graph.transaction().begin()?;
Send queries in a started transaction
// Send a single query let result = transaction.exec("MATCH (n:TRANSACTION) RETURN n")?; // Send multiple queries let results = transaction .with_statement("MATCH (n:TRANSACTION) RETURN n") .with_statement("MATCH (n:OTHER_TRANSACTION) RETURN n") .send()?;
Commit a transaction
transaction.exec("CREATE (n:TRANSACTION)")?; transaction.commit()?; // Send more statements when commiting let results = transaction.with_statement( "MATCH (n:TRANSACTION) RETURN n") .send()?;
Rollback a transaction
transaction.exec("CREATE (n:TRANSACTION)")?; transaction.rollback()?;
Structs
Created | |
Started | |
Transaction |
Provides methods to interact with a transaction |