pub struct QueryResult {
pub columns: Vec<String>,
pub column_types: Vec<LogicalType>,
pub rows: Vec<Vec<Value>>,
}Expand description
The result of running a query.
Contains rows and columns, like a table. Use iter() to
loop through rows, or scalar() if you expect a single value.
§Examples
use grafeo_engine::GrafeoDB;
let db = GrafeoDB::new_in_memory();
db.create_node(&["Person"]);
let result = db.execute("MATCH (p:Person) RETURN count(p) AS total")?;
// Check what we got
println!("Columns: {:?}", result.columns);
println!("Rows: {}", result.row_count());
// Iterate through results
for row in result.iter() {
println!("{:?}", row);
}Fields§
§columns: Vec<String>Column names from the RETURN clause.
column_types: Vec<LogicalType>Column types - useful for distinguishing NodeId/EdgeId from plain integers.
rows: Vec<Vec<Value>>The actual result rows.
Implementations§
Source§impl QueryResult
impl QueryResult
Sourcepub fn with_types(columns: Vec<String>, column_types: Vec<LogicalType>) -> Self
pub fn with_types(columns: Vec<String>, column_types: Vec<LogicalType>) -> Self
Creates a new empty query result with column types.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Returns the number of columns.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryResult
impl RefUnwindSafe for QueryResult
impl Send for QueryResult
impl Sync for QueryResult
impl Unpin for QueryResult
impl UnwindSafe for QueryResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more