With this change it is possible to access to result summary of a query by enabling the unstable-v1 feature:
use neo4rs::*;
use neo4rs::summary::{Type, Counters, ResultSummary};
#[derive(Debug, PartialEq, serde::Deserialize)]
struct Person {
name: String,
}
async fn example() -> Result<()> {
let uri = "127.0.0.1:7687";
let user = "neo4j";
let pass = "password";
let graph = Graph::new(uri, user, pass).await?;
let mut stream = graph
.execute(query("CREATE (n:Person {name: 'Alice'}) RETURN n"))
.await?;
let people = stream.into_stream_as::<Person>()
.try_collect::<Vec<_>>()
.await?;
for person in people {
assert_eq!(person.name, "Alice");
}
let Some(summary) = stream.finish().await? else { panic!("no summary available") };
let summary: ResultSummary = summary; // The type of the summary
assert!(summary.available_after().is_some());
assert!(summary.consumed_after().is_some());
assert!(summary.db().is_some());
assert_eq!(summary.query_type(), Type::ReadWrite);
assert_eq!(summary.stats(), &Counters {
nodes_created: 1,
properties_set: 1,
labels_added: 1,
..Default::default()
});
}
The API is behind an unstable feature flag, so it might change before it is available without a feature flag.
With this change it is possible to access to result summary of a query by enabling the
unstable-v1
feature:The API is behind an unstable feature flag, so it might change before it is available without a feature flag.