use falkordb::{FalkorClientBuilder, FalkorResult};
use tracing_subscriber::fmt::format::FmtSpan;
fn main() -> FalkorResult<()> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::TRACE)
.with_span_events(FmtSpan::CLOSE)
.with_target(true)
.init();
let connection_info = std::env::var("FALKORDB_CONNECTION")
.unwrap_or_else(|_| "falkor://127.0.0.1:6379".to_string());
let client = FalkorClientBuilder::new()
.with_connection_info(connection_info.as_str().try_into()?)
.build()?;
let mut graph = client.select_graph("observability_example");
graph
.query("CREATE (:Movie {title: 'The Matrix', year: 1999})")
.execute()?;
let mut titles = graph
.ro_query("MATCH (m:Movie) WHERE m.title = 'The Matrix' RETURN m.year")
.execute()?;
for row in titles.data.by_ref() {
println!("read-only result: {row:?}");
}
graph.delete()?;
Ok(())
}