-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Gerrit Meier <meistermeier@gmail.com>
- Loading branch information
1 parent
eb134a1
commit c049d14
Showing
4 changed files
with
511 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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()); | ||
|
||
// prepare neo4rs client | ||
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()?; | ||
|
||
// connect ot Neo4j | ||
let graph = neo4rs::Graph::connect(config).await?; | ||
|
||
// run a test query | ||
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(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.