use testcontainers_modules::{neo4j::Neo4j, testcontainers::clients::Cli};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
let docker = Cli::default();
let container = docker.run(Neo4j::default());
let config = neo4rs::ConfigBuilder::new()
.uri(format!(
"bolt://localhost:{}",
container.image().bolt_port_ipv4()
))
.user(container.image().user().expect("default user is set"))
.password(
container
.image()
.password()
.expect("default password is set"),
)
.build()?;
let graph = neo4rs::Graph::connect(config).await?;
let mut rows = graph.execute(neo4rs::query("RETURN 1 + 1")).await?;
while let Some(row) = rows.next().await? {
let result: i64 = row.get("1 + 1").unwrap();
assert_eq!(result, 2);
}
Ok(())
}