Execute a query within this transaction and return results # Arguments `query` - GQL query to execute # Examples ```no_run # use graphlite_sdk::GraphLite; # let db = GraphLite::open("./mydb")?; # let session = db.session("admin")?; let mut tx = session.transaction()?; tx.execute("CREATE (p:Person {name: 'Alice', age: 30})")?; let result = tx.query("MATCH (p:Person) RETURN p")?; tx.commit()?; #
(&mut self, query: &str)
| 127 | /// # Ok::<(), graphlite_sdk::Error>(()) |
| 128 | /// ``` |
| 129 | pub fn query(&mut self, query: &str) -> Result<QueryResult> { |
| 130 | if self.committed { |
| 131 | return Err(Error::Transaction( |
| 132 | "Transaction already committed".to_string(), |
| 133 | )); |
| 134 | } |
| 135 | |
| 136 | self.session |
| 137 | .coordinator() |
| 138 | .process_query(query, self.session.id()) |
| 139 | .map_err(|e| Error::Transaction(format!("Query failed: {}", e))) |
| 140 | } |
| 141 | |
| 142 | /// Commit the transaction |
| 143 | /// |
nothing calls this directly
no test coverage detected