MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / query

Method query

sdk-rust/src/transaction.rs:129–140  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 4

process_queryMethod · 0.80
coordinatorMethod · 0.80
TransactionClass · 0.70
idMethod · 0.45

Tested by

no test coverage detected